diff options
-rw-r--r-- | include/libbb.h | 22 | ||||
-rw-r--r-- | include/platform.h | 1 | ||||
-rw-r--r-- | networking/ntpd.c | 2 |
3 files changed, 24 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h index 37732e14e..03f9c35f3 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -192,6 +192,28 @@ int klogctl(int type, char *b, int len); | |||
192 | # define BUFSIZ 4096 | 192 | # define BUFSIZ 4096 |
193 | #endif | 193 | #endif |
194 | 194 | ||
195 | #if __GNUC_PREREQ(5,0) | ||
196 | /* Since musl is apparently unable to get it right and would use | ||
197 | * a function call to a single-instruction function of "bswap %eax", | ||
198 | * reroute to gcc builtins: | ||
199 | */ | ||
200 | # undef bswap_16 | ||
201 | # undef bswap_32 | ||
202 | # undef bswap_64 | ||
203 | # define bswap_16(x) __builtin_bswap16(x) | ||
204 | # define bswap_32(x) __builtin_bswap32(x) | ||
205 | # define bswap_64(x) __builtin_bswap64(x) | ||
206 | # if BB_LITTLE_ENDIAN | ||
207 | # undef ntohs | ||
208 | # undef htons | ||
209 | # undef ntohl | ||
210 | # undef htonl | ||
211 | # define ntohs(x) __builtin_bswap16(x) | ||
212 | # define htons(x) __builtin_bswap16(x) | ||
213 | # define ntohl(x) __builtin_bswap32(x) | ||
214 | # define htonl(x) __builtin_bswap32(x) | ||
215 | # endif | ||
216 | #endif | ||
195 | 217 | ||
196 | /* Busybox does not use threads, we can speed up stdio. */ | 218 | /* Busybox does not use threads, we can speed up stdio. */ |
197 | #ifdef HAVE_UNLOCKED_STDIO | 219 | #ifdef HAVE_UNLOCKED_STDIO |
diff --git a/include/platform.h b/include/platform.h index 387b6f537..4633b2507 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -195,6 +195,7 @@ | |||
195 | #endif | 195 | #endif |
196 | 196 | ||
197 | #if ULONG_MAX > 0xffffffff | 197 | #if ULONG_MAX > 0xffffffff |
198 | /* inline 64-bit bswap only on 64-bit arches */ | ||
198 | # define bb_bswap_64(x) bswap_64(x) | 199 | # define bb_bswap_64(x) bswap_64(x) |
199 | #endif | 200 | #endif |
200 | 201 | ||
diff --git a/networking/ntpd.c b/networking/ntpd.c index 8cf8830c2..6bf6c4e07 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c | |||
@@ -577,7 +577,7 @@ sfp_to_d(s_fixedpt_t sfp) | |||
577 | return ret; | 577 | return ret; |
578 | } | 578 | } |
579 | #if ENABLE_FEATURE_NTPD_SERVER | 579 | #if ENABLE_FEATURE_NTPD_SERVER |
580 | static void | 580 | static NOINLINE void |
581 | d_to_lfp(l_fixedpt_t *lfp, double d) | 581 | d_to_lfp(l_fixedpt_t *lfp, double d) |
582 | { | 582 | { |
583 | uint32_t intl; | 583 | uint32_t intl; |