All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH]is_power_of_2-sound/pcm_params.h
@ 2007-06-14  8:21 ` vignesh babu
  0 siblings, 0 replies; 2+ messages in thread
From: vignesh babu @ 2007-06-14  8:09 UTC (permalink / raw)
  To: perex; +Cc: Kernel Janitors List, alsa-devel


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

Signed-off-by: vignesh babu <vignesh.babu@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?"

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [KJ] [PATCH]is_power_of_2-sound/pcm_params.h
@ 2007-06-14  8:21 ` vignesh babu
  0 siblings, 0 replies; 2+ messages in thread
From: vignesh babu @ 2007-06-14  8:21 UTC (permalink / raw)
  To: perex; +Cc: Kernel Janitors List, alsa-devel


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

Signed-off-by: vignesh babu <vignesh.babu@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?"

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-14  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-14  8:09 [KJ] [PATCH]is_power_of_2-sound/pcm_params.h vignesh babu
2007-06-14  8:21 ` vignesh babu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.