summaryrefslogtreecommitdiff
path: root/src/basic/macro.h
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-09-13 20:39:58 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-09-13 20:39:58 -0400
commitb3ec0a0674f4e499bcb6d2469acdf9d2d574c3d6 (patch)
tree374687545d464bb1e57991cf73b654a7fa0b83ba /src/basic/macro.h
parentf6e7ffdf3fe8e3ed5e659f747946461350ade5a8 (diff)
parentae8150ecbd54765622aadf288100440d71a10ccd (diff)
Merge tag 'systemd/v231-1.parabola1' into systemd/parabola
Diffstat (limited to 'src/basic/macro.h')
-rw-r--r--src/basic/macro.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/basic/macro.h b/src/basic/macro.h
index e41aa4260f..6b2aeb933f 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -89,6 +89,15 @@
#define UNIQ_T(x, uniq) CONCATENATE(__unique_prefix_, CONCATENATE(x, uniq))
#define UNIQ __COUNTER__
+/* builtins */
+#if __SIZEOF_INT__ == 4
+#define BUILTIN_FFS_U32(x) __builtin_ffs(x);
+#elif __SIZEOF_LONG__ == 4
+#define BUILTIN_FFS_U32(x) __builtin_ffsl(x);
+#else
+#error "neither int nor long are four bytes long?!?"
+#endif
+
/* Rounds up */
#define ALIGN4(l) (((l) + 3) & ~3)