/[mcrypt]/libmcrypt/lib/mcrypt_modules.h
ViewVC logotype

Annotation of /libmcrypt/lib/mcrypt_modules.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Sat Oct 7 18:26:57 2000 UTC (23 years, 6 months ago) by nmav
Branch: MAIN
CVS Tags: libmcrypt_2_4_15, libmcrypt_2_4_16, mcrypt_2_4_20, mcrypt_2_4_12, libmcrypt_2_4_16b, mcrypt_2_4_9, libmcrypt-2_4_9-beta, libmcrypt_2_4_17, libmcrypt_2_4_21, mcrypt_2_4_13
Changes since 1.1: +32 -4 lines
File MIME type: text/plain
added support for local swap functions (if available)

1 nmav 1.2 #define rotl32(x,n) (((x) << ((word32)(n))) | ((x) >> (32 - (word32)(n))))
2     #define rotr32(x,n) (((x) >> ((word32)(n))) | ((x) << (32 - (word32)(n))))
3 nmav 1.1 #define rotl16(x,n) (((x) << ((word16)(n))) | ((x) >> (16 - (word16)(n))))
4     #define rotr16(x,n) (((x) >> ((word16)(n))) | ((x) << (16 - (word16)(n))))
5 nmav 1.2
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 nmav 1.1
36     #define Bzero(x, y) memset(x, 0, y)

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26