diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/machine/endian.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/include/machine/endian.h b/include/machine/endian.h index 4d96a6d..302d29e 100644 --- a/include/machine/endian.h +++ b/include/machine/endian.h | |||
| @@ -1,14 +1,30 @@ | |||
| 1 | #ifndef _COMPAT_BYTE_ORDER_H_ | 1 | #ifndef LIBCRYPTOCOMPAT_BYTE_ORDER_H_ |
| 2 | #define _COMPAT_BYTE_ORDER_H_ | 2 | #define LIBCRYPTOCOMPAT_BYTE_ORDER_H_ |
| 3 | 3 | ||
| 4 | #ifdef __linux__ | 4 | #if defined(__WIN32) |
| 5 | #include <endian.h> | 5 | |
| 6 | #define LITTLE_ENDIAN 1234 | ||
| 7 | #define BIG_ENDIAN 4321 | ||
| 8 | #define PDP_ENDIAN 3412 | ||
| 9 | |||
| 10 | /* | ||
| 11 | * Use GCC and Visual Studio compiler defines to determine endian. | ||
| 12 | */ | ||
| 13 | #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ | ||
| 14 | #define BYTE_ORDER LITTLE_ENDIAN | ||
| 6 | #else | 15 | #else |
| 7 | #ifdef __sun | 16 | #define BYTE_ORDER BIG_ENDIAN |
| 17 | #endif | ||
| 18 | |||
| 19 | #elif defined(__linux__) | ||
| 20 | #include <endian.h> | ||
| 21 | |||
| 22 | #elif defined(__sun) | ||
| 8 | #include <arpa/nameser_compat.h> | 23 | #include <arpa/nameser_compat.h> |
| 24 | |||
| 9 | #else | 25 | #else |
| 10 | #include_next <machine/endian.h> | 26 | #include_next <machine/endian.h> |
| 11 | #endif | 27 | |
| 12 | #endif | 28 | #endif |
| 13 | 29 | ||
| 14 | #endif | 30 | #endif |
