From 689528045e63843040ea2db24bc027224b342368 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 15 May 2008 17:58:11 +0000 Subject: add pa_ulog2() git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2424 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/pulsecore/core-util.h | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); -- cgit