projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d453a4a
)
src/mathutils.c: simplify aubio_is_power_of_two, thanks to Arturo Castro
author
Paul Brossier
<piem@piem.org>
Mon, 8 Feb 2010 18:14:12 +0000
(19:14 +0100)
committer
Paul Brossier
<piem@piem.org>
Mon, 8 Feb 2010 18:14:12 +0000
(19:14 +0100)
src/mathutils.c
patch
|
blob
|
history
diff --git
a/src/mathutils.c
b/src/mathutils.c
index d443fc1b89db221e589e76cc08920a1bb7e62fdb..2bf3be75764609a516c4a81b177b74d838e9970c 100644
(file)
--- a/
src/mathutils.c
+++ b/
src/mathutils.c
@@
-441,12
+441,9
@@
aubio_is_power_of_two (uint_t a)
uint_t
aubio_next_power_of_two (uint_t a)
{
- uint_t i;
- a--;
- for (i = 0; i < sizeof (uint_t) * CHAR_BIT; i++) {
- a = a | a >> 1;
- }
- return a + 1;
+ uint_t i = 1;
+ while (i < a) i <<= 1;
+ return i;
}
smpl_t