diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/util.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/util.c b/common/util.c index 0d7bff2710..f120cdad24 100644 --- a/common/util.c +++ b/common/util.c @@ -273,6 +273,13 @@ int uint64divmod(uint64_t *n, int d) return r; } +int get_next_bit(uint32_t *mask) +{ + int bit = 31 - __builtin_clz(*mask); + *mask &= ~(1 << bit); + return bit; +} + /****************************************************************************/ /* stateful conditional stuff */ |