diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-10-18 11:40:26 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-10-18 11:40:26 +0200 |
commit | 9ff50b869780aba131dc9b542ccd0f1a3959e920 (patch) | |
tree | a1f65f2a5f8c3aa1d6f51bc15c734f2b3ae46ead /include/platform.h | |
parent | b102e12253078e8c0ebdeeb5e1893ea6a025a700 (diff) | |
download | busybox-w32-9ff50b869780aba131dc9b542ccd0f1a3959e920.tar.gz busybox-w32-9ff50b869780aba131dc9b542ccd0f1a3959e920.tar.bz2 busybox-w32-9ff50b869780aba131dc9b542ccd0f1a3959e920.zip |
*: deinline SWAP_xE64 on 32-bit CPUs. Wins !90 bytes both on 32 and 64 bits
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'include/platform.h')
-rw-r--r-- | include/platform.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/platform.h b/include/platform.h index c255a17ce..b5c668517 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -150,6 +150,7 @@ | |||
150 | 150 | ||
151 | /* ---- Endian Detection ------------------------------------ */ | 151 | /* ---- Endian Detection ------------------------------------ */ |
152 | 152 | ||
153 | #include <limits.h> | ||
153 | #if defined(__digital__) && defined(__unix__) | 154 | #if defined(__digital__) && defined(__unix__) |
154 | # include <sex.h> | 155 | # include <sex.h> |
155 | #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ | 156 | #elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ |
@@ -189,6 +190,10 @@ | |||
189 | # error "Can't determine endianness" | 190 | # error "Can't determine endianness" |
190 | #endif | 191 | #endif |
191 | 192 | ||
193 | #if ULONG_MAX > 0xffffffff | ||
194 | # define bb_bswap_64(x) bswap_64(x) | ||
195 | #endif | ||
196 | |||
192 | /* SWAP_LEnn means "convert CPU<->little_endian by swapping bytes" */ | 197 | /* SWAP_LEnn means "convert CPU<->little_endian by swapping bytes" */ |
193 | #if BB_BIG_ENDIAN | 198 | #if BB_BIG_ENDIAN |
194 | # define SWAP_BE16(x) (x) | 199 | # define SWAP_BE16(x) (x) |
@@ -196,13 +201,13 @@ | |||
196 | # define SWAP_BE64(x) (x) | 201 | # define SWAP_BE64(x) (x) |
197 | # define SWAP_LE16(x) bswap_16(x) | 202 | # define SWAP_LE16(x) bswap_16(x) |
198 | # define SWAP_LE32(x) bswap_32(x) | 203 | # define SWAP_LE32(x) bswap_32(x) |
199 | # define SWAP_LE64(x) bswap_64(x) | 204 | # define SWAP_LE64(x) bb_bswap_64(x) |
200 | # define IF_BIG_ENDIAN(...) __VA_ARGS__ | 205 | # define IF_BIG_ENDIAN(...) __VA_ARGS__ |
201 | # define IF_LITTLE_ENDIAN(...) | 206 | # define IF_LITTLE_ENDIAN(...) |
202 | #else | 207 | #else |
203 | # define SWAP_BE16(x) bswap_16(x) | 208 | # define SWAP_BE16(x) bswap_16(x) |
204 | # define SWAP_BE32(x) bswap_32(x) | 209 | # define SWAP_BE32(x) bswap_32(x) |
205 | # define SWAP_BE64(x) bswap_64(x) | 210 | # define SWAP_BE64(x) bb_bswap_64(x) |
206 | # define SWAP_LE16(x) (x) | 211 | # define SWAP_LE16(x) (x) |
207 | # define SWAP_LE32(x) (x) | 212 | # define SWAP_LE32(x) (x) |
208 | # define SWAP_LE64(x) (x) | 213 | # define SWAP_LE64(x) (x) |