libbb.h: inline byteswaps
No binary (build failed)
—
(log yok)
| @@ -192,6 +192,28 @@ int klogctl(int type, char *b, int len); | |
| # define BUFSIZ 4096 | |
| #endif | |
| + | #if __GNUC_PREREQ(5,0) |
| + | /* Since musl is apparently unable to get it right and would use |
| + | * a function call to a single-instruction function of "bswap %eax", |
| + | * reroute to gcc builtins: |
| + | */ |
| + | # undef bswap_16 |
| + | # undef bswap_32 |
| + | # undef bswap_64 |
| + | # define bswap_16(x) __builtin_bswap16(x) |
| + | # define bswap_32(x) __builtin_bswap32(x) |
| + | # define bswap_64(x) __builtin_bswap64(x) |
| + | # if BB_LITTLE_ENDIAN |
| + | # undef ntohs |
| + | # undef htons |
| + | # undef ntohl |
| + | # undef htonl |
| + | # define ntohs(x) __builtin_bswap16(x) |
| + | # define htons(x) __builtin_bswap16(x) |
| + | # define ntohl(x) __builtin_bswap32(x) |
| + | # define htonl(x) __builtin_bswap32(x) |
| + | # endif |
| + | #endif |
| /* Busybox does not use threads, we can speed up stdio. */ | |
| #ifdef HAVE_UNLOCKED_STDIO | |
| @@ -195,6 +195,7 @@ | |
| #endif | |
| #if ULONG_MAX > 0xffffffff | |
| + | /* inline 64-bit bswap only on 64-bit arches */ |
| # define bb_bswap_64(x) bswap_64(x) | |
| #endif | |
| @@ -577,7 +577,7 @@ sfp_to_d(s_fixedpt_t sfp) | |
| return ret; | |
| } | |
| #if ENABLE_FEATURE_NTPD_SERVER | |
| - | static void |
| + | static NOINLINE void |
| d_to_lfp(l_fixedpt_t *lfp, double d) | |
| { | |
| uint32_t intl; | |