diff options
| author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-29 05:51:12 +0000 |
|---|---|---|
| committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-05-29 05:51:12 +0000 |
| commit | 2684187601d4f087e36d2810fc8f67ca0daf9989 (patch) | |
| tree | d2f6adda7dc120be2aa64c7a984f12c8ecf608f2 /include | |
| parent | ec890bc1e05269be205cc1218bae5e090d150a2f (diff) | |
| download | busybox-w32-2684187601d4f087e36d2810fc8f67ca0daf9989.tar.gz busybox-w32-2684187601d4f087e36d2810fc8f67ca0daf9989.tar.bz2 busybox-w32-2684187601d4f087e36d2810fc8f67ca0daf9989.zip | |
Add SWAP_LE?? and SWAP_BE?? macros, and make things use them. Converts values
to/from little endian or big endian, which is a NOP if that's what the current
platform already is.
git-svn-id: svn://busybox.net/trunk/busybox@15215 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'include')
| -rw-r--r-- | include/platform.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/include/platform.h b/include/platform.h index d684c2dda..10c1d7d86 100644 --- a/include/platform.h +++ b/include/platform.h | |||
| @@ -48,11 +48,6 @@ | |||
| 48 | # define __const const | 48 | # define __const const |
| 49 | #endif | 49 | #endif |
| 50 | 50 | ||
| 51 | #ifndef __THROW | ||
| 52 | # define __THROW | ||
| 53 | #endif | ||
| 54 | |||
| 55 | |||
| 56 | #ifndef ATTRIBUTE_UNUSED | 51 | #ifndef ATTRIBUTE_UNUSED |
| 57 | # define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) | 52 | # define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
| 58 | #endif /* ATTRIBUTE_UNUSED */ | 53 | #endif /* ATTRIBUTE_UNUSED */ |
| @@ -118,6 +113,22 @@ | |||
| 118 | # define BB_LITTLE_ENDIAN 1 | 113 | # define BB_LITTLE_ENDIAN 1 |
| 119 | #endif | 114 | #endif |
| 120 | 115 | ||
| 116 | #if BB_BIG_ENDIAN | ||
| 117 | #define SWAP_BE16(x) x | ||
| 118 | #define SWAP_BE32(x) x | ||
| 119 | #define SWAP_BE64(x) x | ||
| 120 | #define SWAP_LE16(x) bswap_16(x) | ||
| 121 | #define SWAP_LE32(x) bswap_32(x) | ||
| 122 | #define SWAP_LE64(x) bswap_64(x) | ||
| 123 | #else | ||
| 124 | #define SWAP_BE16(x) bswap_16(x) | ||
| 125 | #define SWAP_BE32(x) bswap_32(x) | ||
| 126 | #define SWAP_BE64(x) bswap_64(x) | ||
| 127 | #define SWAP_LE16(x) x | ||
| 128 | #define SWAP_LE32(x) x | ||
| 129 | #define SWAP_LE64(x) x | ||
| 130 | #endif | ||
| 131 | |||
| 121 | /* ---- Networking ------------------------------------------ */ | 132 | /* ---- Networking ------------------------------------------ */ |
| 122 | #ifndef __APPLE__ | 133 | #ifndef __APPLE__ |
| 123 | # include <arpa/inet.h> | 134 | # include <arpa/inet.h> |
