summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/libbb.h22
-rw-r--r--include/platform.h1
-rw-r--r--networking/ntpd.c2
3 files changed, 24 insertions, 1 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 37732e1..03f9c35 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -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
diff --git a/include/platform.h b/include/platform.h
index 387b6f5..4633b25 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -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
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 8cf8830..6bf6c4e 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -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;