diff options
author | Brent Cook <bcook@openbsd.org> | 2014-07-20 13:59:03 -0500 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2014-07-20 16:30:50 -0500 |
commit | 136ddd7a9bcec800f12520c4a08e642477ddabda (patch) | |
tree | 7f899cfab3a65ebba4c6ce2d8246050d7294d970 | |
parent | 9c2c499bf3141fbcb61f4ca3fdbc77d451768bc8 (diff) | |
download | portable-136ddd7a9bcec800f12520c4a08e642477ddabda.tar.gz portable-136ddd7a9bcec800f12520c4a08e642477ddabda.tar.bz2 portable-136ddd7a9bcec800f12520c4a08e642477ddabda.zip |
update guard, add win32 support for endian.h
Thanks to Jonas 'Sortie' Termansen for pointing the guard inconsistency out.
ok beck@
-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 |