summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-12-29 19:41:46 +0100
committerTakashi Iwai <tiwai@suse.de>2014-12-30 16:41:56 +0100
commit757b037650c9ecca79a46ab744820b1b3c1bb49d (patch)
treeddd7ee816fb028d527cdbb7a4af82786e58b5019
parentf6dbe1bee59741cd7699e7da3019e67c77d9bd6f (diff)
downloadop-kernel-dev-757b037650c9ecca79a46ab744820b1b3c1bb49d.zip
op-kernel-dev-757b037650c9ecca79a46ab744820b1b3c1bb49d.tar.gz
ALSA: pcm: Replace custom ld2 function with __fls
__fls has the same semantics as ld2, so there is no need to re-implement it. Furthermore a lot of architectures have custom implementations of __fls that are able to use special hardware instructions to compute the result. This makes the code slightly shorter and faster. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/pcm_params.h27
1 files changed, 1 insertions, 26 deletions
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index c99e20b..3c45f39 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -38,31 +38,6 @@ int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params,
#define MASK_OFS(i) ((i) >> 5)
#define MASK_BIT(i) (1U << ((i) & 31))
-static inline unsigned int ld2(u_int32_t v)
-{
- unsigned r = 0;
-
- if (v >= 0x10000) {
- v >>= 16;
- r += 16;
- }
- if (v >= 0x100) {
- v >>= 8;
- r += 8;
- }
- if (v >= 0x10) {
- v >>= 4;
- r += 4;
- }
- if (v >= 4) {
- v >>= 2;
- r += 2;
- }
- if (v >= 2)
- r++;
- return r;
-}
-
static inline size_t snd_mask_sizeof(void)
{
return sizeof(struct snd_mask);
@@ -102,7 +77,7 @@ static inline unsigned int snd_mask_max(const struct snd_mask *mask)
int i;
for (i = SNDRV_MASK_SIZE - 1; i >= 0; i--) {
if (mask->bits[i])
- return ld2(mask->bits[i]) + (i << 5);
+ return __fls(mask->bits[i]) + (i << 5);
}
return 0;
}
OpenPOWER on IntegriCloud