aboutsummaryrefslogtreecommitdiffstats
path: root/audio/ossaudio.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-09-22 14:19:28 +0200
committerDavid 'Digit' Turner <digit@android.com>2010-09-22 14:19:28 +0200
commit4e024bb4f5c8aa8b07459f7fbd65c35122127fd1 (patch)
treeccd5835eef17757d3e1c069e391c415c0135023d /audio/ossaudio.c
parent1d9873b37d2478554d9d678cd410bd3638c8dab3 (diff)
downloadexternal_qemu-4e024bb4f5c8aa8b07459f7fbd65c35122127fd1.zip
external_qemu-4e024bb4f5c8aa8b07459f7fbd65c35122127fd1.tar.gz
external_qemu-4e024bb4f5c8aa8b07459f7fbd65c35122127fd1.tar.bz2
Remove compiler warnings when building the emulator.
This forces -Wall during the build. Note that this patch doesn't remove all warnings, but most of the remaining ones are from upstream anyway. Change-Id: I8808d8495e99866e156ce5780d2e3c305eab491f
Diffstat (limited to 'audio/ossaudio.c')
-rw-r--r--audio/ossaudio.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index f946f79..ceb81ce 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -36,6 +36,23 @@
#define AUDIO_CAP "oss"
#include "audio_int.h"
+/* 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);
+}
+
typedef struct OSSVoiceOut {
HWVoiceOut hw;
void *pcm_buf;