diff options
author | Chris Robinson <[email protected]> | 2011-10-04 22:39:35 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-10-04 22:39:35 -0700 |
commit | 75fee8c11f76889285e3b68cc1f3d13e92dacc26 (patch) | |
tree | 89e4ceabb2bd14d18304408db70b78de38264d7f | |
parent | 9e11b0a8c6c521a0c8b4dc4ed7c05017a787ca62 (diff) |
Add min/max/clamp methods for 64-bit int
-rw-r--r-- | Alc/mixer.c | 3 | ||||
-rw-r--r-- | OpenAL32/Include/alu.h | 7 |
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) { |