summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-05-15 17:58:11 +0000
committerLennart Poettering <lennart@poettering.net>2008-05-15 17:58:11 +0000
commit689528045e63843040ea2db24bc027224b342368 (patch)
tree253ee796c146f40f84165d3adeb19877c44166f7
parent103ceaa94488516b0ce0f7b2d428348469db43ce (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.h11
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);