aboutsummaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authormalc <av1474@comtv.ru>2009-09-12 02:39:29 +0400
committermalc <av1474@comtv.ru>2009-09-12 02:50:58 +0400
commit057fa65c5ddf915d73b69964f32fc854c914efd4 (patch)
treea8a756cfbf97cfc13d896efa7c49a6167b1bbfeb /audio
parentalsa: poll mode handling (diff)
downloadqemu-kvm-057fa65c5ddf915d73b69964f32fc854c914efd4.tar.gz
qemu-kvm-057fa65c5ddf915d73b69964f32fc854c914efd4.tar.bz2
qemu-kvm-057fa65c5ddf915d73b69964f32fc854c914efd4.zip
audio: remove lsbindex/popcount in favour of host-utils's ctz32
Signed-off-by: malc <av1474@comtv.ru>
Diffstat (limited to 'audio')
-rw-r--r--audio/audio.c17
-rw-r--r--audio/audio.h3
-rw-r--r--audio/ossaudio.c3
3 files changed, 2 insertions, 21 deletions
diff --git a/audio/audio.c b/audio/audio.c
index ea6ae1b1e..aa9ea3ea0 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -112,23 +112,6 @@ struct mixeng_volume nominal_volume = {
#endif
};
-/* http://www.df.lth.se/~john_e/gems/gem002d.html */
-/* http://www.multi-platforms.com/Tips/PopCount.htm */
-uint32_t popcount (uint32_t u)
-{
- u = ((u&0x55555555) + ((u>>1)&0x55555555));
- u = ((u&0x33333333) + ((u>>2)&0x33333333));
- u = ((u&0x0f0f0f0f) + ((u>>4)&0x0f0f0f0f));
- u = ((u&0x00ff00ff) + ((u>>8)&0x00ff00ff));
- u = ( u&0x0000ffff) + (u>>16);
- return u;
-}
-
-inline uint32_t lsbindex (uint32_t u)
-{
- return popcount ((u&-u)-1);
-}
-
#ifdef AUDIO_IS_FLAWLESS_AND_NO_CHECKS_ARE_REQURIED
#error No its not
#else
diff --git a/audio/audio.h b/audio/audio.h
index fda2af342..dec86e5f7 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -147,9 +147,6 @@ static inline void *advance (void *p, int incr)
return (d + incr);
}
-uint32_t popcount (uint32_t u);
-uint32_t lsbindex (uint32_t u);
-
#ifdef __GNUC__
#define audio_MIN(a, b) ( __extension__ ({ \
__typeof (a) ta = a; \
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index f2385df5f..2cc3c6f5c 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -31,6 +31,7 @@
#include <sys/soundcard.h>
#endif
#include "qemu-common.h"
+#include "host-utils.h"
#include "qemu-char.h"
#include "audio.h"
@@ -273,7 +274,7 @@ static int oss_open (int in, struct oss_params *req,
goto err;
}
- mmmmssss = (req->nfrags << 16) | lsbindex (req->fragsize);
+ mmmmssss = (req->nfrags << 16) | ctz32 (req->fragsize);
if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {
oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n",
req->nfrags, req->fragsize);