Skip to content
Snippets Groups Projects
Select Git revision
  • struct-layout
  • master default protected
  • streebog
  • gost28147
  • master-updates
  • ed448
  • shake256
  • curve448
  • ecc-sqrt
  • gosthash94cp
  • cmac64
  • block16-refactor
  • siv-mode
  • cmac-layout
  • delete-des-compat
  • delete-rsa_blind
  • aes-struct-layout
  • release-3.4-fixes
  • attribute-deprecated
  • rename-data-symbols
  • nettle_3.5.1_release_20190627
  • nettle_3.5_release_20190626
  • nettle_3.5rc1
  • nettle_3.4.1_release_20181204
  • nettle_3.4.1rc1
  • nettle_3.4_release_20171119
  • nettle_3.4rc2
  • nettle_3.4rc1
  • nettle_3.3_release_20161001
  • nettle_3.2_release_20160128
  • nettle_3.1.1_release_20150424
  • nettle_3.1_release_20150407
  • nettle_3.1rc3
  • nettle_3.1rc2
  • nettle_3.1rc1
  • nettle_3.0_release_20140607
  • nettle_2.7.1_release_20130528
  • nettle_2.7_release_20130424
  • nettle_2.6_release_20130116
  • nettle_2.5_release_20120707
40 results

.gitattributes

Blame
  • Forked from Nettle / nettle
    Source project has a limited visibility.
    Int.pmod 5.01 KiB
    #pike __REAL_VERSION__
    
    //! Returns the parity of the integer @[value]. If the
    //! parity is odd 1 is returned. If it is even 0 is
    //! returned.
    int(0..1) parity(int(0..) value) {
      if(value<0) error("Parity can not determined for negative values.\n");
      return Gmp.mpz(value)->popcount()&1;
    }
    
    constant NATIVE_MIN = __builtin.NATIVE_INT_MIN;
    constant NATIVE_MAX = __builtin.NATIVE_INT_MAX;
    
    //! @decl constant NATIVE_MIN;
    //! @decl constant NATIVE_MAX;
    //!
    //! The limits for using the native representation of integers on the
    //! current architecture. Any integer that is outside this range uses
    //! a more complex and slower representation. Also, some builtin
    //! functions that don't expect very large integers might start to
    //! complain about invalid argument type when given values outside
    //! this range (they typically say something like "Expected integer,
    //! got object").
    //!
    //! @[NATIVE_MIN] is not greater than @expr{-2147483648@}
    //! (@expr{-0x80000000@}).
    //!
    //! @[NATIVE_MAX] is not less than @expr{2147483647@}
    //! (@expr{0x7fffffff@}).
    //!
    //! @note
    //! The size of the native integers can be controlled when Pike is
    //! compiled with the configure flags @expr{--with-int-int@},
    //! @expr{--with-long-int@}, and @expr{--with-long-long-int@}. The
    //! default is to use the longest available integer type that fits
    //! inside a pointer, which typically means that it's 64 bit on "true"
    //! 64 bit architectures.
    //!
    
    //! Swaps the upper and lower byte in a word.
    //!
    //! @seealso
    //!   @[swap_long()]
    int(0..65535) swap_word(int(0..65535) i) {
      return ((i&255)<<8) | ((i&(255<<8))>>8);
    }
    
    //! Swaps the upper and lower word in a longword, and the upper and
    //! lower bytes in the words. Simply put, the bytes are reversed.
    //!
    //! @seealso
    //!   @[swap_word()]
    int(0..4294967295) swap_long(int(0..4294967295) i) {
      return ((i&255)<<24) | ((i&(255<<8))<<8) |
        ((i&(255<<16))>>8) | ((i&(255<<24))>>24);
    }
    
    //! Reverses the order of the low order @[bits] number of bits
    //! of the value @[value].
    //!
    //! @note
    //!   Any higher order bits of the value will be cleared.
    //!   The returned value will thus be unsigned.
    //!
    //! @seealso
    //!   @[reverse()], @[swap_word()], @[swap_long()]
    int(0..) reflect(int value, int(0..) bits)
    {
      int aligned_bits = bits;
      if (bits & (bits-1)) {