aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-12-05 15:17:39 -0800
committerChris Robinson <[email protected]>2022-12-05 15:17:39 -0800
commit4de5c7dfeebc2335ad3d7c2dd4905284677a68c9 (patch)
tree849a6f5dd7b284e1766671cc13769d257f20ea03 /core
parentdf6d61dd40b602af55f903564358b083bb8b37e4 (diff)
Avoid some uses of the LIKELY/UNLIKELY macros
Diffstat (limited to 'core')
-rw-r--r--core/bformatdec.cpp2
-rw-r--r--core/converter.cpp2
-rw-r--r--core/device.h2
-rw-r--r--core/except.cpp2
-rw-r--r--core/logging.h6
-rw-r--r--core/mastering.cpp2
-rw-r--r--core/mixer/hrtfbase.h4
-rw-r--r--core/voice.cpp4
8 files changed, 12 insertions, 12 deletions
diff --git a/core/bformatdec.cpp b/core/bformatdec.cpp
index 606093c0..5c3f1864 100644
--- a/core/bformatdec.cpp
+++ b/core/bformatdec.cpp
@@ -115,7 +115,7 @@ void BFormatDec::processStablize(const al::span<FloatBufferLine> OutBuffer,
auto &DelayBuf = mStablizer->DelayBuf[i];
auto buffer_end = OutBuffer[i].begin() + SamplesToDo;
- if LIKELY(SamplesToDo >= FrontStablizer::DelayLength)
+ if(SamplesToDo >= FrontStablizer::DelayLength) [[allikely]]
{
auto delay_end = std::rotate(OutBuffer[i].begin(),
buffer_end - FrontStablizer::DelayLength, buffer_end);
diff --git a/core/converter.cpp b/core/converter.cpp
index 75c37149..e0fbaecd 100644
--- a/core/converter.cpp
+++ b/core/converter.cpp
@@ -143,7 +143,7 @@ void Multi2Mono(uint chanmask, const size_t step, const float scale, float *REST
std::fill_n(dst, frames, 0.0f);
for(size_t c{0};chanmask;++c)
{
- if LIKELY((chanmask&1))
+ if((chanmask&1)) [[allikely]]
{
for(size_t i{0u};i < frames;i++)
dst[i] += LoadSample<T>(ssrc[i*step + c]);
diff --git a/core/device.h b/core/device.h
index 292c1730..a287dd57 100644
--- a/core/device.h
+++ b/core/device.h
@@ -277,7 +277,7 @@ struct DeviceBase {
void ProcessBs2b(const size_t SamplesToDo);
inline void postProcess(const size_t SamplesToDo)
- { if LIKELY(PostProcess) (this->*PostProcess)(SamplesToDo); }
+ { if(PostProcess) [[allikely]] (this->*PostProcess)(SamplesToDo); }
void renderSamples(const al::span<float*> outBuffers, const uint numSamples);
void renderSamples(void *outBuffer, const uint numSamples, const size_t frameStep);
diff --git a/core/except.cpp b/core/except.cpp
index 07bb410a..5e757ed7 100644
--- a/core/except.cpp
+++ b/core/except.cpp
@@ -19,7 +19,7 @@ void base_exception::setMessage(const char* msg, std::va_list args)
std::va_list args2;
va_copy(args2, args);
int msglen{std::vsnprintf(nullptr, 0, msg, args)};
- if LIKELY(msglen > 0)
+ if(msglen > 0) [[allikely]]
{
mMessage.resize(static_cast<size_t>(msglen)+1);
std::vsnprintf(&mMessage[0], mMessage.length(), msg, args2);
diff --git a/core/logging.h b/core/logging.h
index 81465929..87f1c0f5 100644
--- a/core/logging.h
+++ b/core/logging.h
@@ -19,17 +19,17 @@ extern FILE *gLogFile;
#if !defined(_WIN32) && !defined(__ANDROID__)
#define TRACE(...) do { \
- if UNLIKELY(gLogLevel >= LogLevel::Trace) \
+ if(gLogLevel >= LogLevel::Trace) [[alunlikely]] \
fprintf(gLogFile, "[ALSOFT] (II) " __VA_ARGS__); \
} while(0)
#define WARN(...) do { \
- if UNLIKELY(gLogLevel >= LogLevel::Warning) \
+ if(gLogLevel >= LogLevel::Warning) [[alunlikely]] \
fprintf(gLogFile, "[ALSOFT] (WW) " __VA_ARGS__); \
} while(0)
#define ERR(...) do { \
- if UNLIKELY(gLogLevel >= LogLevel::Error) \
+ if(gLogLevel >= LogLevel::Error) [[alunlikely]] \
fprintf(gLogFile, "[ALSOFT] (EE) " __VA_ARGS__); \
} while(0)
diff --git a/core/mastering.cpp b/core/mastering.cpp
index 99850477..6a085c3a 100644
--- a/core/mastering.cpp
+++ b/core/mastering.cpp
@@ -295,7 +295,7 @@ void SignalDelay(Compressor *Comp, const uint SamplesToDo, FloatBufferLine *OutB
float *delaybuf{al::assume_aligned<16>(Comp->mDelay[c].data())};
auto inout_end = inout + SamplesToDo;
- if LIKELY(SamplesToDo >= lookAhead)
+ if(SamplesToDo >= lookAhead) [[allikely]]
{
auto delay_end = std::rotate(inout, inout_end - lookAhead, inout_end);
std::swap_ranges(inout, delay_end, delaybuf);
diff --git a/core/mixer/hrtfbase.h b/core/mixer/hrtfbase.h
index 606f9d4e..c8c78263 100644
--- a/core/mixer/hrtfbase.h
+++ b/core/mixer/hrtfbase.h
@@ -50,7 +50,7 @@ inline void MixHrtfBlendBase(const float *InSamples, float2 *RESTRICT AccumSampl
const ConstHrirSpan NewCoeffs{newparams->Coeffs};
const float newGainStep{newparams->GainStep};
- if LIKELY(oldparams->Gain > GainSilenceThreshold)
+ if(oldparams->Gain > GainSilenceThreshold) [[allikely]]
{
size_t ldelay{HrtfHistoryLength - oldparams->Delay[0]};
size_t rdelay{HrtfHistoryLength - oldparams->Delay[1]};
@@ -66,7 +66,7 @@ inline void MixHrtfBlendBase(const float *InSamples, float2 *RESTRICT AccumSampl
}
}
- if LIKELY(newGainStep*static_cast<float>(BufferSize) > GainSilenceThreshold)
+ if(newGainStep*static_cast<float>(BufferSize) > GainSilenceThreshold) [[allikely]]
{
size_t ldelay{HrtfHistoryLength+1 - newparams->Delay[0]};
size_t rdelay{HrtfHistoryLength+1 - newparams->Delay[1]};
diff --git a/core/voice.cpp b/core/voice.cpp
index 2a524215..0b4884a0 100644
--- a/core/voice.cpp
+++ b/core/voice.cpp
@@ -473,7 +473,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
VoiceBufferItem *BufferListItem{mCurrentBuffer.load(std::memory_order_relaxed)};
VoiceBufferItem *BufferLoopItem{mLoopBuffer.load(std::memory_order_relaxed)};
const uint increment{mStep};
- if UNLIKELY(increment < 1)
+ if(increment < 1) [[alunlikely]]
{
/* If the voice is supposed to be stopping but can't be mixed, just
* stop it before bailing.
@@ -536,7 +536,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi
}
}
}
- else if UNLIKELY(!BufferListItem)
+ else if(!BufferListItem) [[alunlikely]]
Counter = std::min(Counter, 64u);
std::array<float*,DeviceBase::MixerChannelsMax> SamplePointers;