From: Clemens Ladisch Date: Mon, 27 Feb 2006 08:53:03 +0000 (+0100) Subject: [ALSA] usb-audio: optimize snd_usbmidi_count_bits() X-Git-Tag: v2.6.17-rc1~1129^2^2~67 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=62f09c3d321c82981ae3f2dd7e32bc4c73379a7e;p=linux-2.6-omap-h63xx.git [ALSA] usb-audio: optimize snd_usbmidi_count_bits() Modules: USB generic driver Reduce the code size of the snd_usbmidi_count_bits() function by using simpler operations. Signed-off-by: Clemens Ladisch --- diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 7580339dba2..2b9d940c806 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -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; }