diff options
-rw-r--r-- | Alc/backends/coreaudio.cpp | 6 | ||||
-rw-r--r-- | Alc/backends/null.cpp | 4 | ||||
-rw-r--r-- | Alc/backends/wasapi.cpp | 2 | ||||
-rw-r--r-- | Alc/backends/wave.cpp | 4 | ||||
-rw-r--r-- | Alc/backends/winmm.cpp | 4 | ||||
-rw-r--r-- | Alc/converter.cpp | 4 | ||||
-rw-r--r-- | Alc/effects/pshifter.cpp | 14 | ||||
-rw-r--r-- | Alc/mixvoice.cpp | 2 | ||||
-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 |
13 files changed, 52 insertions, 55 deletions
diff --git a/Alc/backends/coreaudio.cpp b/Alc/backends/coreaudio.cpp index c5da9f24..432733f4 100644 --- a/Alc/backends/coreaudio.cpp +++ b/Alc/backends/coreaudio.cpp @@ -177,8 +177,8 @@ ALCboolean CoreAudioPlayback::reset() if(mDevice->Frequency != streamFormat.mSampleRate) { - mDevice->NumUpdates = static_cast<ALuint>( - (ALuint64)mDevice->NumUpdates*streamFormat.mSampleRate/mDevice->Frequency); + mDevice->NumUpdates = static_cast<ALuint>(uint64_t{mDevice->NumUpdates} * + streamFormat.mSampleRate / mDevice->Frequency); mDevice->Frequency = streamFormat.mSampleRate; } @@ -594,7 +594,7 @@ ALCenum CoreAudioCapture::open(const ALCchar *name) } // Set the AudioUnit output format frame count - ALuint64 FrameCount64{mDevice->UpdateSize}; + uint64_t FrameCount64{mDevice->UpdateSize}; FrameCount64 = (FrameCount64*outputFormat.mSampleRate + mDevice->Frequency-1) / mDevice->Frequency; FrameCount64 += MAX_RESAMPLE_PADDING*2; diff --git a/Alc/backends/null.cpp b/Alc/backends/null.cpp index 38ac0154..8bd84656 100644 --- a/Alc/backends/null.cpp +++ b/Alc/backends/null.cpp @@ -69,7 +69,7 @@ int NullBackend::mixerProc() SetRTPriority(); althrd_setname(MIXER_THREAD_NAME); - ALint64 done{0}; + int64_t done{0}; auto start = std::chrono::steady_clock::now(); while(!mKillNow.load(std::memory_order_acquire) && mDevice->Connected.load(std::memory_order_acquire)) @@ -77,7 +77,7 @@ int NullBackend::mixerProc() auto now = std::chrono::steady_clock::now(); /* This converts from nanoseconds to nanosamples, then to samples. */ - ALint64 avail{std::chrono::duration_cast<seconds>((now-start) * mDevice->Frequency).count()}; + int64_t avail{std::chrono::duration_cast<seconds>((now-start) * mDevice->Frequency).count()}; if(avail-done < mDevice->UpdateSize) { std::this_thread::sleep_for(restTime); diff --git a/Alc/backends/wasapi.cpp b/Alc/backends/wasapi.cpp index 8904ca3a..ba26b70c 100644 --- a/Alc/backends/wasapi.cpp +++ b/Alc/backends/wasapi.cpp @@ -87,7 +87,7 @@ namespace { /* Scales the given value using 64-bit integer math, ceiling the result. */ -inline ALint64 ScaleCeil(ALint64 val, ALint64 new_scale, ALint64 old_scale) +inline int64_t ScaleCeil(int64_t val, int64_t new_scale, int64_t old_scale) { return (val*new_scale + old_scale-1) / old_scale; } diff --git a/Alc/backends/wave.cpp b/Alc/backends/wave.cpp index aa1aab1f..cd6c6d5c 100644 --- a/Alc/backends/wave.cpp +++ b/Alc/backends/wave.cpp @@ -117,7 +117,7 @@ int WaveBackend::mixerProc() const ALsizei frameSize{mDevice->frameSizeFromFmt()}; - ALint64 done{0}; + int64_t done{0}; auto start = std::chrono::steady_clock::now(); while(!mKillNow.load(std::memory_order_acquire) && mDevice->Connected.load(std::memory_order_acquire)) @@ -125,7 +125,7 @@ int WaveBackend::mixerProc() auto now = std::chrono::steady_clock::now(); /* This converts from nanoseconds to nanosamples, then to samples. */ - ALint64 avail{std::chrono::duration_cast<seconds>((now-start) * + int64_t avail{std::chrono::duration_cast<seconds>((now-start) * mDevice->Frequency).count()}; if(avail-done < mDevice->UpdateSize) { diff --git a/Alc/backends/winmm.cpp b/Alc/backends/winmm.cpp index 34eade29..89f0e866 100644 --- a/Alc/backends/winmm.cpp +++ b/Alc/backends/winmm.cpp @@ -265,8 +265,8 @@ retry_open: ALCboolean WinMMPlayback::reset() { - mDevice->UpdateSize = static_cast<ALuint>( - (ALuint64)mDevice->UpdateSize * mFormat.nSamplesPerSec / mDevice->Frequency); + mDevice->UpdateSize = static_cast<ALuint>(uint64_t{mDevice->UpdateSize} * + mFormat.nSamplesPerSec / mDevice->Frequency); mDevice->UpdateSize = (mDevice->UpdateSize*mDevice->NumUpdates + 3) / 4; mDevice->NumUpdates = 4; mDevice->Frequency = mFormat.nSamplesPerSec; diff --git a/Alc/converter.cpp b/Alc/converter.cpp index 9ec97e23..884a98da 100644 --- a/Alc/converter.cpp +++ b/Alc/converter.cpp @@ -195,7 +195,7 @@ ALsizei SampleConverter::availableOut(ALsizei srcframes) const return 0; } - auto DataSize64 = static_cast<ALuint64>(prepcount); + auto DataSize64 = static_cast<uint64_t>(prepcount); DataSize64 += srcframes; DataSize64 -= MAX_RESAMPLE_PADDING*2; DataSize64 <<= FRACTIONBITS; @@ -252,7 +252,7 @@ ALsizei SampleConverter::convert(const ALvoid **src, ALsizei *srcframes, ALvoid ALfloat *RESTRICT SrcData{mSrcSamples}; ALfloat *RESTRICT DstData{mDstSamples}; ALsizei DataPosFrac{mFracOffset}; - auto DataSize64 = static_cast<ALuint64>(prepcount); + auto DataSize64 = static_cast<uint64_t>(prepcount); DataSize64 += toread; DataSize64 -= MAX_RESAMPLE_PADDING*2; DataSize64 <<= FRACTIONBITS; diff --git a/Alc/effects/pshifter.cpp b/Alc/effects/pshifter.cpp index 7bd7ada0..9fe5f867 100644 --- a/Alc/effects/pshifter.cpp +++ b/Alc/effects/pshifter.cpp @@ -50,11 +50,11 @@ inline int double2int(double d) { #if ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) && \ !defined(__SSE2_MATH__)) || (defined(_MSC_VER) && defined(_M_IX86_FP) && _M_IX86_FP < 2) - ALint sign, shift; - ALint64 mant; + int sign, shift; + int64_t mant; union { - ALdouble d; - ALint64 i64; + double d; + int64_t i64; } conv; conv.d = d; @@ -67,12 +67,12 @@ inline int double2int(double d) mant = (conv.i64&0xfffffffffffff_i64) | 0x10000000000000_i64; if(LIKELY(shift < 0)) - return (ALint)(mant >> -shift) * sign; - return (ALint)(mant << shift) * sign; + return (int)(mant >> -shift) * sign; + return (int)(mant << shift) * sign; #else - return static_cast<ALint>(d); + return static_cast<int>(d); #endif } diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 6fecb830..a0518ed5 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -367,7 +367,7 @@ ALboolean MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context, ALsizei DstBufferSize{SamplesToDo - OutPos}; /* Calculate the last written dst sample pos. */ - ALint64 DataSize64{DstBufferSize - 1}; + int64_t DataSize64{DstBufferSize - 1}; /* Calculate the last read src sample pos. */ DataSize64 = (DataSize64*increment + DataPosFrac) >> FRACTIONBITS; /* +1 to get the src sample count, include padding. */ 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)}; |