equal
deleted
inserted
replaced
56 # endif |
56 # endif |
57 #endif |
57 #endif |
58 #endif /* _SLEEP_H */ |
58 #endif /* _SLEEP_H */ |
59 |
59 |
60 |
60 |
|
61 /* check compiler requirements */ |
|
62 #if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) |
|
63 #error Do not know the endianess of this architecture |
|
64 #endif |
61 |
65 |
|
66 /* use byteswap macros from the host system, hopefully optimized ones ;-) |
|
67 * or define our own version, simple, stupid, straight-forward... */ |
|
68 #ifdef HAVE_BYTESWAP_H |
|
69 #include <byteswap.h> |
|
70 #else |
|
71 #define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) |
|
72 #define bswap_32(x) ((((x) & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | \ |
|
73 (((x) & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24) ) |
|
74 #endif /* HAVE_BYTESWAP_H */ |
62 |
75 |
63 |
76 /* swap numbers accordingly to architecture automatically */ |
|
77 #ifdef __LITTLE_ENDIAN__ |
|
78 #define ENDIAN_LITTLE_32(x) x |
|
79 #define ENDIAN_BIG_32(x) bswap_32(x) |
|
80 #define ENDIAN_LITTLE_16(x) x |
|
81 #define ENDIAN_BIG_16(x) bswap_16(x) |
|
82 #elif __BIG_ENDIAN__ |
|
83 #define ENDIAN_LITTLE_32(x) bswap_32(x) |
|
84 #define ENDIAN_BIG_32(x) x |
|
85 #define ENDIAN_LITTLE_16(x) bswap_16(x) |
|
86 #define ENDIAN_BIG_16(x) x |
|
87 #endif |
64 |
88 |
65 |
89 |
66 #ifdef __CPLUSPLUS |
90 #ifdef __CPLUSPLUS |
67 extern "C" { |
91 extern "C" { |
68 #endif |
92 #endif |