[alsa-devel] [PATCH]is_power_of_2-sound/pcm_params.h

vignesh babu vignesh.babu at wipro.com
Thu Jun 14 10:09:52 CEST 2007



Replacing (n & (n-1)) in the context of power of 2 checks
with is_power_of_2

Signed-off-by: vignesh babu <vignesh.babu at wipro.com>
--- 
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index 85cf1cf..dee298e 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -21,6 +21,7 @@
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
  */
+#include <linux/log2.h>
 
 int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm, 
 			   struct snd_pcm_hw_params *params,
@@ -170,7 +171,7 @@ static inline int snd_mask_single(const struct snd_mask *mask)
 	for (i = 0; i < SNDRV_MASK_SIZE; i++) {
 		if (! mask->bits[i])
 			continue;
-		if (mask->bits[i] & (mask->bits[i] - 1))
+		if (!is_power_of_2(mask->bits[i]))
 			return 0;
 		if (c)
 			return 0;

-- 
Vignesh Babu BM 
_____________________________________________________________ 
"Why is it that every time I'm with you, makes me believe in magic?"



The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
 
www.wipro.com


More information about the Alsa-devel mailing list