Page MenuHomeFreeBSD
Authored By
cem
Jan 10 2018, 1:04 AM
Size
991 B
Referenced Files
None
Subscribers
None
--- sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h (revision 327712)
+++ sys/contrib/zstd/lib/freebsd/zstd_kfreebsd.h (working copy)
@@ -49,6 +49,44 @@
#define calloc(a,b) (malloc)((a)*(b), M_ZSTD, M_WAITOK | M_ZERO)
#endif
+#undef __builtin_ctz
+#undef __builtin_ctzll
+#undef __builtin_clz
+#undef __builtin_clzll
+#undef __builtin_bswap32
+#undef __builtin_bswap64
+
+#define __builtin_bswap32 bswap32
+#define __builtin_bswap64 bswap64
+
+static inline int
+__builtin_ctz(int x)
+{
+ if (x == 0)
+ return (sizeof(x) * NBBY);
+ return (ffs(x) - 1);
+}
+
+static inline long long
+__builtin_ctzll(long long x)
+{
+ if (x == 0)
+ return (sizeof(x) * NBBY);
+ return (ffsll(x) - 1);
+}
+
+static inline int
+__builtin_clz(int x)
+{
+ return (sizeof(x) * NBBY - fls(x));
+}
+
+static inline long long
+__builtin_clzll(long long x)
+{
+ return (sizeof(x) * NBBY - flsll(x));
+}
+
#ifdef __cplusplus
}
#endif

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1252866
Default Alt Text
(991 B)

Event Timeline