summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorCristian Rodríguez <crrodriguez@opensuse.org>2013-04-04 20:09:50 -0300
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-04-05 00:17:35 -0400
commit144e51eca20b72c8177314c225d8c15c1b0b9d6b (patch)
treee7cbe68e619a5cae506318edc7489469c61451fe /src/shared
parente8853816bf197afc71819e28f1316a5d5ee4b4c3 (diff)
journal: u64log2 can be expressed just as __builtin_clzll(n) ^ 63U
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 69a47653aa..7c3da08dd8 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -635,3 +635,7 @@ static inline void _reset_umask_(struct umask_struct *s) {
for (__attribute__((cleanup(_reset_umask_))) struct umask_struct _saved_umask_ = { umask(mask), false }; \
!_saved_umask_.quit ; \
_saved_umask_.quit = true)
+
+static inline unsigned u64log2(uint64_t n) {
+ return (n > 1) ? __builtin_clzll(n) ^ 63U : 0;
+}