diff options
author | Chris Robinson <[email protected]> | 2020-05-19 12:15:57 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-05-19 12:15:57 -0700 |
commit | c5e90ed6c7878178d92aef372d67ed12d126bfc0 (patch) | |
tree | d4761b076ce4b14ed0094dea641fdb75dc7b7e0f | |
parent | 825206bfa2b59ae124cc8fb34c5b668f8a682224 (diff) |
Use an enum for FamCount
-rw-r--r-- | alc/bformatdec.h | 4 | ||||
-rw-r--r-- | alc/converter.cpp | 2 | ||||
-rw-r--r-- | alc/front_stablizer.h | 2 | ||||
-rw-r--r-- | alc/hrtf.cpp | 4 | ||||
-rw-r--r-- | alc/ringbuffer.cpp | 2 | ||||
-rw-r--r-- | common/almalloc.h | 6 |
6 files changed, 9 insertions, 11 deletions
diff --git a/alc/bformatdec.h b/alc/bformatdec.h index 3d05324d..428af281 100644 --- a/alc/bformatdec.h +++ b/alc/bformatdec.h @@ -57,13 +57,13 @@ public: static std::unique_ptr<BFormatDec> Create(const AmbDecConf *conf, const bool allow_2band, const size_t inchans, const ALuint srate, const ALuint (&chanmap)[MAX_OUTPUT_CHANNELS]) { - return std::unique_ptr<BFormatDec>{new(FamCount{inchans}) + return std::unique_ptr<BFormatDec>{new(FamCount(inchans)) BFormatDec{conf, allow_2band, inchans, srate, chanmap}}; } static std::unique_ptr<BFormatDec> Create(const size_t inchans, const al::span<const ChannelDec> coeffs, const al::span<const ChannelDec> coeffslf) { - return std::unique_ptr<BFormatDec>{new(FamCount{inchans}) + return std::unique_ptr<BFormatDec>{new(FamCount(inchans)) BFormatDec{inchans, coeffs, coeffslf}}; } diff --git a/alc/converter.cpp b/alc/converter.cpp index 47a3bfce..ead0c2f6 100644 --- a/alc/converter.cpp +++ b/alc/converter.cpp @@ -153,7 +153,7 @@ SampleConverterPtr CreateSampleConverter(DevFmtType srcType, DevFmtType dstType, if(numchans < 1 || srcRate < 1 || dstRate < 1) return nullptr; - SampleConverterPtr converter{new (FamCount{numchans}) SampleConverter{numchans}}; + SampleConverterPtr converter{new(FamCount(numchans)) SampleConverter{numchans}}; converter->mSrcType = srcType; converter->mDstType = dstType; converter->mSrcTypeSize = BytesFromDevFmt(srcType); diff --git a/alc/front_stablizer.h b/alc/front_stablizer.h index 91309bf7..bcffbb69 100644 --- a/alc/front_stablizer.h +++ b/alc/front_stablizer.h @@ -25,7 +25,7 @@ struct FrontStablizer { al::FlexArray<DelayLine,16> DelayBuf; static std::unique_ptr<FrontStablizer> Create(size_t numchans) - { return std::unique_ptr<FrontStablizer>{new(FamCount{numchans}) FrontStablizer{numchans}}; } + { return std::unique_ptr<FrontStablizer>{new(FamCount(numchans)) FrontStablizer{numchans}}; } DEF_FAM_NEWDEL(FrontStablizer, DelayBuf) }; diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp index 89e07efc..7f951f35 100644 --- a/alc/hrtf.cpp +++ b/alc/hrtf.cpp @@ -277,9 +277,7 @@ void GetHrtfCoeffs(const HrtfStore *Hrtf, float elevation, float azimuth, float std::unique_ptr<DirectHrtfState> DirectHrtfState::Create(size_t num_chans) -{ - return std::unique_ptr<DirectHrtfState>{new (FamCount{num_chans}) DirectHrtfState{num_chans}}; -} +{ return std::unique_ptr<DirectHrtfState>{new(FamCount(num_chans)) DirectHrtfState{num_chans}}; } void DirectHrtfState::build(const HrtfStore *Hrtf, const al::span<const AngularPoint> AmbiPoints, const float (*AmbiMatrix)[MAX_AMBI_CHANNELS], diff --git a/alc/ringbuffer.cpp b/alc/ringbuffer.cpp index f4146a7d..5d891dbe 100644 --- a/alc/ringbuffer.cpp +++ b/alc/ringbuffer.cpp @@ -50,7 +50,7 @@ RingBufferPtr RingBuffer::Create(size_t sz, size_t elem_sz, int limit_writes) throw std::overflow_error{"Ring buffer size overflow"}; const size_t bufbytes{power_of_two * elem_sz}; - RingBufferPtr rb{new (FamCount{bufbytes}) RingBuffer{bufbytes}}; + RingBufferPtr rb{new(FamCount(bufbytes)) RingBuffer{bufbytes}}; rb->mWriteSize = limit_writes ? sz : (power_of_two-1); rb->mSizeMask = power_of_two - 1; rb->mElemSize = elem_sz; diff --git a/common/almalloc.h b/common/almalloc.h index 599d21c4..5afab7e1 100644 --- a/common/almalloc.h +++ b/common/almalloc.h @@ -43,15 +43,15 @@ void al_free(void *ptr) noexcept; void operator delete[](void *block, void*) noexcept { al_free(block); } \ void operator delete[](void *block) noexcept { al_free(block); } -struct FamCount { size_t mCount; }; +enum FamCount : size_t { }; #define DEF_FAM_NEWDEL(T, FamMem) \ static constexpr size_t Sizeof(size_t count) noexcept \ { return decltype(FamMem)::Sizeof(count, offsetof(T, FamMem)); } \ \ - void *operator new(size_t /*size*/, FamCount fam) \ + void *operator new(size_t /*size*/, FamCount count) \ { \ - if(void *ret{al_malloc(alignof(T), T::Sizeof(fam.mCount))}) \ + if(void *ret{al_malloc(alignof(T), T::Sizeof(count))}) \ return ret; \ throw std::bad_alloc(); \ } \ |