aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/mixer.c3
-rw-r--r--OpenAL32/Include/alu.h7
2 files changed, 8 insertions, 2 deletions
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 231aa0fd..4646a262 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -565,8 +565,7 @@ ALvoid MixSource(ALsource *Source, ALCdevice *Device, ALuint SamplesToDo)
DataSize64 += BufferPadding+BufferPrePadding;
DataSize64 *= NumChannels;
- BufferSize = (ALuint)((DataSize64 > STACK_DATA_SIZE/sizeof(ALfloat)) ?
- STACK_DATA_SIZE/sizeof(ALfloat) : DataSize64);
+ BufferSize = (ALuint)mini64(DataSize64, STACK_DATA_SIZE/sizeof(ALfloat));
BufferSize /= NumChannels;
if(Source->lSourceType == AL_STATIC)
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 814b5034..7ee2aa31 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -175,6 +175,13 @@ static __inline ALint maxi(ALint a, ALint b)
static __inline ALint clampi(ALint val, ALint min, ALint max)
{ return mini(max, maxi(min, val)); }
+static __inline ALint64 mini64(ALint64 a, ALint64 b)
+{ return ((a > b) ? b : a); }
+static __inline ALint64 maxi64(ALint64 a, ALint64 b)
+{ return ((a > b) ? a : b); }
+static __inline ALint64 clampi64(ALint64 val, ALint64 min, ALint64 max)
+{ return mini64(max, maxi64(min, val)); }
+
static __inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu)
{