diff options
Diffstat (limited to 'audio')
-rw-r--r-- | audio/audio.c | 2 | ||||
-rw-r--r-- | audio/ossaudio.c | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/audio/audio.c b/audio/audio.c index aa4102b..6f107dc 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -201,6 +201,7 @@ struct mixeng_volume nominal_volume = { #endif }; +#if 0 /* http://www.df.lth.se/~john_e/gems/gem002d.html */ /* http://www.multi-platforms.com/Tips/PopCount.htm */ uint32_t popcount (uint32_t u) @@ -217,6 +218,7 @@ inline uint32_t lsbindex (uint32_t u) { return popcount ((u&-u)-1); } +#endif #ifdef AUDIO_IS_FLAWLESS_AND_NO_CHECKS_ARE_REQURIED #error No its not 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; |