diff options
author | Lennart Poettering <lennart@poettering.net> | 2008-05-15 17:58:11 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2008-05-15 17:58:11 +0000 |
commit | 689528045e63843040ea2db24bc027224b342368 (patch) | |
tree | 253ee796c146f40f84165d3adeb19877c44166f7 | |
parent | 103ceaa94488516b0ce0f7b2d428348469db43ce (diff) |
add pa_ulog2()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2424 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r-- | src/pulsecore/core-util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h index 49315b55..e9313d4b 100644 --- a/src/pulsecore/core-util.h +++ b/src/pulsecore/core-util.h @@ -155,6 +155,17 @@ static inline unsigned pa_make_power_of_two(unsigned n) { return n + 1; } +static inline unsigned pa_ulog2(unsigned n) { + unsigned r = 0; + + while (n) { + r++; + n = n >> 1; + } + + return r; +} + void pa_close_pipe(int fds[2]); char *pa_readlink(const char *p); |