Skip to content

Commit

Permalink
[ALSA] usb-audio: optimize snd_usbmidi_count_bits()
Browse files Browse the repository at this point in the history
Modules: USB generic driver

Reduce the code size of the snd_usbmidi_count_bits() function by using
simpler operations.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
  • Loading branch information
Clemens Ladisch authored and Jaroslav Kysela committed Mar 22, 2006
1 parent 62c5549 commit 62f09c3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/usb/usbmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,10 +871,10 @@ static int snd_usbmidi_in_endpoint_create(struct snd_usb_midi* umidi,

static unsigned int snd_usbmidi_count_bits(unsigned int x)
{
unsigned int bits = 0;
unsigned int bits;

for (; x; x >>= 1)
bits += x & 1;
for (bits = 0; x; ++bits)
x &= x - 1;
return bits;
}

Expand Down

0 comments on commit 62f09c3

Please sign in to comment.