Changeset 7581185 for src/mathutils.c


Ignore:
Timestamp:
Feb 8, 2010, 7:14:12 PM (10 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
fc759f3
Parents:
d453a4a
Message:

src/mathutils.c: simplify aubio_is_power_of_two, thanks to Arturo Castro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mathutils.c

    rd453a4a r7581185  
    442442aubio_next_power_of_two (uint_t a)
    443443{
    444   uint_t i;
    445   a--;
    446   for (i = 0; i < sizeof (uint_t) * CHAR_BIT; i++) {
    447     a = a | a >> 1;
    448   }
    449   return a + 1;
     444  uint_t i = 1;
     445  while (i < a) i <<= 1;
     446  return i;
    450447}
    451448
Note: See TracChangeset for help on using the changeset viewer.