diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/util.h | 4 |
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; +} |