aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/alMain.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-11-19 09:50:15 -0800
committerChris Robinson <[email protected]>2009-11-19 09:50:15 -0800
commit8d1da6a8ca48469a10614c33e0eadc7e7f1d4f13 (patch)
treebc5856b2a348eb0ed3799f5c5876c7c734f910be /OpenAL32/Include/alMain.h
parentff8e09495d846f303479e75d11ef8b2e2957265f (diff)
Move NextPowerOf2 to alMain.h
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r--OpenAL32/Include/alMain.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index c929b358..2bcecf05 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -164,6 +164,24 @@ static __inline void al_print(const char *fname, unsigned int line, const char *
#define LOWPASSFREQCUTOFF (5000)
+// Find the next power-of-2 for non-power-of-2 numbers.
+static __inline ALuint NextPowerOf2(ALuint value)
+{
+ ALuint powerOf2 = 1;
+
+ if(value)
+ {
+ value--;
+ while(value)
+ {
+ value >>= 1;
+ powerOf2 <<= 1;
+ }
+ }
+ return powerOf2;
+}
+
+
typedef struct {
ALCboolean (*OpenPlayback)(ALCdevice*, const ALCchar*);
void (*ClosePlayback)(ALCdevice*);