diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alMain.h | 15 | ||||
-rw-r--r-- | OpenAL32/alBuffer.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/alEffect.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/alFilter.cpp | 2 | ||||
-rw-r--r-- | OpenAL32/alSource.cpp | 46 |
5 files changed, 32 insertions, 35 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index e93d3db4..1e35b2f6 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -55,9 +55,6 @@ constexpr inline size_t countof(const T(&)[N]) noexcept #endif -using ALint64 = ALint64SOFT; -using ALuint64 = ALuint64SOFT; - /* Define CTZ macros (count trailing zeros), and POPCNT macros (population * count/count 1 bits), for 32- and 64-bit integers. The CTZ macros' results * are *UNDEFINED* if the value is 0. @@ -87,10 +84,10 @@ inline int msvc64_ctz32(ALuint v) } #define CTZ32 msvc64_ctz32 -inline int msvc64_popcnt64(ALuint64 v) +inline int msvc64_popcnt64(uint64_t v) { return (int)__popcnt64(v); } #define POPCNT64 msvc64_popcnt64 -inline int msvc64_ctz64(ALuint64 v) +inline int msvc64_ctz64(uint64_t v) { unsigned long idx = 64; _BitScanForward64(&idx, v); @@ -111,10 +108,10 @@ inline int msvc_ctz32(ALuint v) } #define CTZ32 msvc_ctz32 -inline int msvc_popcnt64(ALuint64 v) +inline int msvc_popcnt64(uint64_t v) { return (int)(__popcnt((ALuint)v) + __popcnt((ALuint)(v>>32))); } #define POPCNT64 msvc_popcnt64 -inline int msvc_ctz64(ALuint64 v) +inline int msvc_ctz64(uint64_t v) { unsigned long idx = 64; if(!_BitScanForward(&idx, v&0xffffffff)) @@ -147,7 +144,7 @@ inline int fallback_ctz32(ALuint value) { return fallback_popcnt32(~value & (value - 1)); } #define CTZ32 fallback_ctz32 -inline int fallback_popcnt64(ALuint64 v) +inline int fallback_popcnt64(uint64_t v) { v = v - ((v >> 1) & 0x5555555555555555_u64); v = (v & 0x3333333333333333_u64) + ((v >> 2) & 0x3333333333333333_u64); @@ -155,7 +152,7 @@ inline int fallback_popcnt64(ALuint64 v) return (int)((v * 0x0101010101010101_u64) >> 56); } #define POPCNT64 fallback_popcnt64 -inline int fallback_ctz64(ALuint64 value) +inline int fallback_ctz64(uint64_t value) { return fallback_popcnt64(~value & (value - 1)); } #define CTZ64 fallback_ctz64 #endif diff --git a/OpenAL32/alBuffer.cpp b/OpenAL32/alBuffer.cpp index 85871573..68f0e40b 100644 --- a/OpenAL32/alBuffer.cpp +++ b/OpenAL32/alBuffer.cpp @@ -1174,7 +1174,7 @@ ALsizei ChannelsFromFmt(FmtChannels chans) BufferSubList::~BufferSubList() { - ALuint64 usemask = ~FreeMask; + uint64_t usemask{~FreeMask}; while(usemask) { ALsizei idx{CTZ64(usemask)}; diff --git a/OpenAL32/alEffect.cpp b/OpenAL32/alEffect.cpp index ca05bad9..f9b94c75 100644 --- a/OpenAL32/alEffect.cpp +++ b/OpenAL32/alEffect.cpp @@ -569,7 +569,7 @@ void InitEffect(ALeffect *effect) EffectSubList::~EffectSubList() { - ALuint64 usemask = ~FreeMask; + uint64_t usemask{~FreeMask}; while(usemask) { ALsizei idx = CTZ64(usemask); diff --git a/OpenAL32/alFilter.cpp b/OpenAL32/alFilter.cpp index a7b814f6..086f5289 100644 --- a/OpenAL32/alFilter.cpp +++ b/OpenAL32/alFilter.cpp @@ -620,7 +620,7 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *va FilterSubList::~FilterSubList() { - ALuint64 usemask = ~FreeMask; + uint64_t usemask{~FreeMask}; while(usemask) { ALsizei idx = CTZ64(usemask); diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index e15b0f59..dd418a58 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -153,11 +153,11 @@ void UpdateSourceProps(const ALsource *source, ALvoice *voice, ALCcontext *conte * samples. The offset is relative to the start of the queue (not the start of * the current buffer). */ -ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, std::chrono::nanoseconds *clocktime) +int64_t GetSourceSampleOffset(ALsource *Source, ALCcontext *context, std::chrono::nanoseconds *clocktime) { ALCdevice *device{context->Device}; const ALbufferlistitem *Current; - ALuint64 readPos; + uint64_t readPos; ALuint refcount; ALvoice *voice; @@ -173,8 +173,8 @@ ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, std::chrono { Current = voice->current_buffer.load(std::memory_order_relaxed); - readPos = static_cast<ALuint64>(voice->position.load(std::memory_order_relaxed)) << 32; - readPos |= static_cast<ALuint64>(voice->position_fraction.load(std::memory_order_relaxed)) << + readPos = uint64_t{voice->position.load(std::memory_order_relaxed)} << 32; + readPos |= int64_t{voice->position_fraction.load(std::memory_order_relaxed)} << (32-FRACTIONBITS); } std::atomic_thread_fence(std::memory_order_acquire); @@ -185,13 +185,13 @@ ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, std::chrono const ALbufferlistitem *BufferList{Source->queue}; while(BufferList && BufferList != Current) { - readPos += static_cast<ALuint64>(BufferList->max_samples) << 32; + readPos += int64_t{BufferList->max_samples} << 32; BufferList = BufferList->next.load(std::memory_order_relaxed); } readPos = minu64(readPos, 0x7fffffffffffffff_u64); } - return static_cast<ALint64>(readPos); + return static_cast<int64_t>(readPos); } /* GetSourceSecOffset @@ -203,7 +203,7 @@ ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, std::chrono:: { ALCdevice *device{context->Device}; const ALbufferlistitem *Current; - ALuint64 readPos; + uint64_t readPos; ALuint refcount; ALvoice *voice; @@ -219,7 +219,7 @@ ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, std::chrono:: { Current = voice->current_buffer.load(std::memory_order_relaxed); - readPos = static_cast<ALuint64>(voice->position.load(std::memory_order_relaxed)) << FRACTIONBITS; + readPos = uint64_t{voice->position.load(std::memory_order_relaxed)} << FRACTIONBITS; readPos |= voice->position_fraction.load(std::memory_order_relaxed); } std::atomic_thread_fence(std::memory_order_acquire); @@ -234,7 +234,7 @@ ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, std::chrono:: { for(ALsizei i{0};!BufferFmt && i < BufferList->num_buffers;++i) BufferFmt = BufferList->buffers[i]; - readPos += static_cast<ALuint64>(BufferList->max_samples) << FRACTIONBITS; + readPos += int64_t{BufferList->max_samples} << FRACTIONBITS; BufferList = BufferList->next.load(std::memory_order_relaxed); } @@ -1626,7 +1626,7 @@ ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALdouble *values); ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint *values); -ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64 *values); +ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64SOFT *values); ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALdouble *values) { @@ -1961,7 +1961,7 @@ ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, AL prop); } -ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64 *values) +ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64SOFT *values) { ALCdevice *device = Context->Device; ClockLatency clocktime; @@ -2018,7 +2018,7 @@ ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, case AL_CONE_OUTER_GAINHF: case AL_SOURCE_RADIUS: if((err=GetSourcedv(Source, Context, prop, dvals)) != AL_FALSE) - *values = static_cast<ALint64>(dvals[0]); + *values = static_cast<int64_t>(dvals[0]); return err; /* 3x float/double */ @@ -2027,9 +2027,9 @@ ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, case AL_DIRECTION: if((err=GetSourcedv(Source, Context, prop, dvals)) != AL_FALSE) { - values[0] = static_cast<ALint64>(dvals[0]); - values[1] = static_cast<ALint64>(dvals[1]); - values[2] = static_cast<ALint64>(dvals[2]); + values[0] = static_cast<int64_t>(dvals[0]); + values[1] = static_cast<int64_t>(dvals[1]); + values[2] = static_cast<int64_t>(dvals[2]); } return err; @@ -2037,12 +2037,12 @@ ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, case AL_ORIENTATION: if((err=GetSourcedv(Source, Context, prop, dvals)) != AL_FALSE) { - values[0] = static_cast<ALint64>(dvals[0]); - values[1] = static_cast<ALint64>(dvals[1]); - values[2] = static_cast<ALint64>(dvals[2]); - values[3] = static_cast<ALint64>(dvals[3]); - values[4] = static_cast<ALint64>(dvals[4]); - values[5] = static_cast<ALint64>(dvals[5]); + values[0] = static_cast<int64_t>(dvals[0]); + values[1] = static_cast<int64_t>(dvals[1]); + values[2] = static_cast<int64_t>(dvals[2]); + values[3] = static_cast<int64_t>(dvals[3]); + values[4] = static_cast<int64_t>(dvals[4]); + values[5] = static_cast<int64_t>(dvals[5]); } return err; @@ -2640,7 +2640,7 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64 alSetError(context.get(), AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param); else { - ALint64 i64vals[3]; + ALint64SOFT i64vals[3]; if(GetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), i64vals)) { *value1 = i64vals[0]; @@ -3399,7 +3399,7 @@ void UpdateAllSourceProps(ALCcontext *context) SourceSubList::~SourceSubList() { - ALuint64 usemask = ~FreeMask; + uint64_t usemask{~FreeMask}; while(usemask) { ALsizei idx{CTZ64(usemask)}; |