On Wed, 2011-11-02 at 21:54 +0100, Maarten Bosmans wrote: > --- > src/modules/oss/oss-util.c | 19 +++++-------------- > 1 files changed, 5 insertions(+), 14 deletions(-) > > diff --git a/src/modules/oss/oss-util.c b/src/modules/oss/oss-util.c > index 04899af..9412a87 100644 > --- a/src/modules/oss/oss-util.c > +++ b/src/modules/oss/oss-util.c > @@ -231,23 +231,14 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) { > return 0; > } > > -static int simple_log2(int v) { > - int k = 0; > - > - for (;;) { > - v >>= 1; > - if (!v) break; > - k++; > - } > - > - return k; > -} > - > int pa_oss_set_fragments(int fd, int nfrags, int frag_size) { > int arg; > - arg = ((int) nfrags << 16) | simple_log2(frag_size); > > - pa_log_debug("Asking for %i fragments of size %i (requested %i)", nfrags, 1 << simple_log2(frag_size), frag_size); > + pa_assert(frag_size >= 0); > + > + arg = ((int) nfrags << 16) | pa_ulog2(frag_size); > + > + pa_log_debug("Asking for %i fragments of size %i (requested %i)", nfrags, 1 << pa_ulog2(frag_size), frag_size); > > if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &arg) < 0) { > pa_log("SNDCTL_DSP_SETFRAGMENT: %s", pa_cstrerror(errno)); Pulled. -- Arun