"Fossies" - the Fresh Open Source Software Archive

Member "libmcrypt-2.5.8/lib/mcrypt_modules.h" (9 Mar 2002, 1104 Bytes) of package /linux/privat/old/libmcrypt-2.5.8.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "mcrypt_modules.h" see the Fossies "Dox" file reference documentation.

    1 #define rotl32(x,n)   (((x) << ((word32)(n))) | ((x) >> (32 - (word32)(n))))
    2 #define rotr32(x,n)   (((x) >> ((word32)(n))) | ((x) << (32 - (word32)(n))))
    3 #define rotl16(x,n)   (((x) << ((word16)(n))) | ((x) >> (16 - (word16)(n))))
    4 #define rotr16(x,n)   (((x) >> ((word16)(n))) | ((x) << (16 - (word16)(n))))
    5 
    6 /* Use hardware rotations.. when available */
    7 #ifdef swap32
    8 # define byteswap32(x) swap32(x)
    9 #else
   10 # ifdef swap_32
   11 #  define byteswap32(x) swap_32(x)
   12 # else
   13 #  ifdef bswap_32
   14 #   define byteswap32(x) bswap_32(x)
   15 #  else
   16 #   define byteswap32(x)    ((rotl32(x, 8) & 0x00ff00ff) | (rotr32(x, 8) & 0xff00ff00))
   17 #  endif
   18 # endif
   19 #endif
   20 
   21 #ifdef swap16
   22 # define byteswap16(x) swap16(x)
   23 #else
   24 # ifdef swap_16
   25 #  define byteswap16(x) swap_16(x)
   26 # else
   27 #  ifdef bswap_16
   28 #   define byteswap16(x) bswap_16(x)
   29 #  else
   30 #   define byteswap16(x)    ((rotl16(x, 8) & 0x00ff) | (rotr16(x, 8) & 0xff00))
   31 #  endif
   32 # endif
   33 #endif
   34 
   35 inline static
   36 void memxor(unsigned char *o1, unsigned char *o2, int length)
   37 {
   38     int i;
   39 
   40     for (i = 0; i < length; i++) {
   41         o1[i] ^= o2[i];
   42     }
   43     return;
   44 }
   45 
   46 
   47 #define Bzero(x, y) memset(x, 0, y)