… | |
… | |
35 | |
35 | |
36 | /* Useful defines & typedefs */ |
36 | /* Useful defines & typedefs */ |
37 | |
37 | |
38 | #if defined(U64TYPE) && (defined(USE_64_BIT_INT) || ((BYTEORDER != 0x1234) && (BYTEORDER != 0x4321))) |
38 | #if defined(U64TYPE) && (defined(USE_64_BIT_INT) || ((BYTEORDER != 0x1234) && (BYTEORDER != 0x4321))) |
39 | typedef U64TYPE ULONG; |
39 | typedef U64TYPE ULONG; |
40 | # if BYTEORDER == 0x1234 |
40 | # if BYTEORDER == 0x1234 |
41 | # undef BYTEORDER |
41 | # undef BYTEORDER |
42 | # define BYTEORDER 0x12345678 |
42 | # define BYTEORDER 0x12345678 |
43 | # elif BYTEORDER == 0x4321 |
43 | # elif BYTEORDER == 0x4321 |
44 | # undef BYTEORDER |
44 | # undef BYTEORDER |
45 | # define BYTEORDER 0x87654321 |
45 | # define BYTEORDER 0x87654321 |
46 | # endif |
46 | # endif |
47 | #else |
47 | #else |
48 | typedef uint_fast32_t ULONG; /* 32-or-more-bit quantity */ |
48 | typedef uint_fast32_t ULONG; /* 32-or-more-bit quantity */ |
49 | #endif |
49 | #endif |
50 | |
50 | |
51 | #if GCCX86ASM |
51 | #if GCCX86ASM |
52 | # define zprefix(n) ({ int _r; __asm__ ("bsrl %1, %0" : "=r" (_r) : "r" (n)); 31 - _r ; }) |
52 | # define zprefix(n) ({ int _r; __asm__ ("bsrl %1, %0" : "=r" (_r) : "r" (n)); 31 - _r ; }) |
|
|
53 | #elif __GNUC__ > 2 && __GNUC_MINOR__ > 3 |
|
|
54 | # define zprefix(n) (__extension__ ({ uint32_t n__ = (n); n ? __builtin_clz (n) : 32; })) |
53 | #else |
55 | #else |
54 | static int zprefix (ULONG n) |
56 | static int zprefix (ULONG n) |
55 | { |
57 | { |
56 | static char zp[256] = |
58 | static char zp[256] = |
57 | { |
59 | { |