aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp4
-rw-r--r--alc/alu.cpp10
-rw-r--r--alc/backends/jack.cpp4
-rw-r--r--alc/backends/opensl.cpp2
-rw-r--r--alc/backends/pulseaudio.cpp26
5 files changed, 23 insertions, 23 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index fb9ab430..2e474f3e 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -2414,7 +2414,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
bool ResetDeviceParams(ALCdevice *device, const int *attrList)
{
/* If the device was disconnected, reset it since we're opened anew. */
- if UNLIKELY(!device->Connected.load(std::memory_order_relaxed))
+ if(!device->Connected.load(std::memory_order_relaxed)) [[alunlikely]]
{
/* Make sure disconnection is finished before continuing on. */
device->waitForMix();
@@ -2446,7 +2446,7 @@ bool ResetDeviceParams(ALCdevice *device, const int *attrList)
}
ALCenum err{UpdateDeviceParams(device, attrList)};
- if LIKELY(err == ALC_NO_ERROR) return ALC_TRUE;
+ if(err == ALC_NO_ERROR) [[allikely]] return ALC_TRUE;
alcSetError(device, err);
return ALC_FALSE;
diff --git a/alc/alu.cpp b/alc/alu.cpp
index f2f5f04b..a50a232e 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -487,7 +487,7 @@ bool CalcEffectSlotParams(EffectSlot *slot, EffectSlot **sorted_slots, ContextBa
/* Otherwise, if it would be deleted send it off with a release event. */
RingBuffer *ring{context->mAsyncEvents.get()};
auto evt_vec = ring->getWriteVector();
- if LIKELY(evt_vec.first.len > 0)
+ if(evt_vec.first.len > 0) [[allikely]]
{
AsyncEvent *evt{al::construct_at(reinterpret_cast<AsyncEvent*>(evt_vec.first.buf),
AsyncEvent::ReleaseEffectState)};
@@ -1821,7 +1821,7 @@ void ProcessParamUpdates(ContextBase *ctx, const EffectSlotArray &slots,
ProcessVoiceChanges(ctx);
IncrementRef(ctx->mUpdateCount);
- if LIKELY(!ctx->mHoldUpdates.load(std::memory_order_acquire))
+ if(!ctx->mHoldUpdates.load(std::memory_order_acquire)) [[allikely]]
{
bool force{CalcContextParams(ctx)};
auto sorted_slots = const_cast<EffectSlot**>(slots.data() + slots.size());
@@ -1913,7 +1913,7 @@ void ProcessContexts(DeviceBase *device, const uint SamplesToDo)
* left that don't target any sorted slots, they can't
* contribute to the output, so leave them.
*/
- if UNLIKELY(next_target == split_point)
+ if(next_target == split_point) [[alunlikely]]
break;
--next_target;
@@ -1956,7 +1956,7 @@ void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const size_t Sam
float *inout{al::assume_aligned<16>(chanbuffer.data())};
auto inout_end = inout + SamplesToDo;
- if LIKELY(SamplesToDo >= base)
+ if(SamplesToDo >= base) [[allikely]]
{
auto delay_end = std::rotate(inout, inout_end - base, inout_end);
std::swap_ranges(inout, delay_end, distbuf);
@@ -2131,7 +2131,7 @@ void DeviceBase::renderSamples(void *outBuffer, const uint numSamples, const siz
{
const uint samplesToDo{renderSamples(todo)};
- if LIKELY(outBuffer)
+ if(outBuffer) [[allikely]]
{
/* Finally, interleave and convert samples, writing to the device's
* output buffer.
diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp
index 2b0131b3..afa26b23 100644
--- a/alc/backends/jack.cpp
+++ b/alc/backends/jack.cpp
@@ -340,7 +340,7 @@ int JackPlayback::processRt(jack_nframes_t numframes) noexcept
out[numchans++] = static_cast<float*>(jack_port_get_buffer(port, numframes));
}
- if LIKELY(mPlaying.load(std::memory_order_acquire))
+ if(mPlaying.load(std::memory_order_acquire)) [[allikely]]
mDevice->renderSamples({out.data(), numchans}, static_cast<uint>(numframes));
else
{
@@ -364,7 +364,7 @@ int JackPlayback::process(jack_nframes_t numframes) noexcept
}
jack_nframes_t total{0};
- if LIKELY(mPlaying.load(std::memory_order_acquire))
+ if(mPlaying.load(std::memory_order_acquire)) [[allikely]]
{
auto data = mRing->getReadVector();
jack_nframes_t todo{minu(numframes, static_cast<uint>(data.first.len))};
diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp
index 48642496..901d2ebe 100644
--- a/alc/backends/opensl.cpp
+++ b/alc/backends/opensl.cpp
@@ -148,7 +148,7 @@ const char *res_str(SLresult result) noexcept
}
#define PRINTERR(x, s) do { \
- if UNLIKELY((x) != SL_RESULT_SUCCESS) \
+ if((x) != SL_RESULT_SUCCESS) [[alunlikely]] \
ERR("%s: %s\n", (s), res_str((x))); \
} while(0)
diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp
index 3862ec2e..7f8a8fb3 100644
--- a/alc/backends/pulseaudio.cpp
+++ b/alc/backends/pulseaudio.cpp
@@ -687,8 +687,8 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) noexce
do {
pa_free_cb_t free_func{nullptr};
auto buflen = static_cast<size_t>(-1);
- void *buf;
- if UNLIKELY(pa_stream_begin_write(stream, &buf, &buflen) || !buf)
+ void *buf{};
+ if(pa_stream_begin_write(stream, &buf, &buflen) || !buf) [[alunlikely]]
{
buflen = nbytes;
buf = pa_xmalloc(buflen);
@@ -701,7 +701,7 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) noexce
mDevice->renderSamples(buf, static_cast<uint>(buflen/mFrameSize), mSpec.channels);
int ret{pa_stream_write(stream, buf, buflen, free_func, 0, PA_SEEK_RELATIVE)};
- if UNLIKELY(ret != PA_OK)
+ if(ret != PA_OK) [[alunlikely]]
ERR("Failed to write to stream: %d, %s\n", ret, pa_strerror(ret));
} while(nbytes > 0);
}
@@ -1046,7 +1046,7 @@ ClockLatency PulsePlayback::getClockLatency()
err = pa_stream_get_latency(mStream, &latency, &neg);
}
- if UNLIKELY(err != 0)
+ if(err != 0) [[alunlikely]]
{
/* If err = -PA_ERR_NODATA, it means we were called too soon after
* starting the stream and no timing info has been received from the
@@ -1057,7 +1057,7 @@ ClockLatency PulsePlayback::getClockLatency()
latency = mDevice->BufferSize - mDevice->UpdateSize;
neg = 0;
}
- else if UNLIKELY(neg)
+ else if(neg) [[alunlikely]]
latency = 0;
ret.Latency = std::chrono::microseconds{latency};
@@ -1284,7 +1284,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples)
if(!mCapBuffer.empty())
{
const size_t rem{minz(dstbuf.size(), mCapBuffer.size())};
- if UNLIKELY(mCapLen < 0)
+ if(mCapLen < 0) [[alunlikely]]
std::fill_n(dstbuf.begin(), rem, mSilentVal);
else
std::copy_n(mCapBuffer.begin(), rem, dstbuf.begin());
@@ -1294,7 +1294,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples)
continue;
}
- if UNLIKELY(!mDevice->Connected.load(std::memory_order_acquire))
+ if(!mDevice->Connected.load(std::memory_order_acquire)) [[alunlikely]]
break;
MainloopUniqueLock plock{mMainloop};
@@ -1305,14 +1305,14 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples)
mCapLen = 0;
}
const pa_stream_state_t state{pa_stream_get_state(mStream)};
- if UNLIKELY(!PA_STREAM_IS_GOOD(state))
+ if(!PA_STREAM_IS_GOOD(state)) [[alunlikely]]
{
mDevice->handleDisconnect("Bad capture state: %u", state);
break;
}
const void *capbuf;
size_t caplen;
- if UNLIKELY(pa_stream_peek(mStream, &capbuf, &caplen) < 0)
+ if(pa_stream_peek(mStream, &capbuf, &caplen) < 0) [[alunlikely]]
{
mDevice->handleDisconnect("Failed retrieving capture samples: %s",
pa_strerror(pa_context_errno(mContext)));
@@ -1321,7 +1321,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples)
plock.unlock();
if(caplen == 0) break;
- if UNLIKELY(!capbuf)
+ if(!capbuf) [[alunlikely]]
mCapLen = -static_cast<ssize_t>(caplen);
else
mCapLen = static_cast<ssize_t>(caplen);
@@ -1339,7 +1339,7 @@ uint PulseCapture::availableSamples()
{
MainloopUniqueLock plock{mMainloop};
size_t got{pa_stream_readable_size(mStream)};
- if UNLIKELY(static_cast<ssize_t>(got) < 0)
+ if(static_cast<ssize_t>(got) < 0) [[alunlikely]]
{
const char *err{pa_strerror(static_cast<int>(got))};
ERR("pa_stream_readable_size() failed: %s\n", err);
@@ -1370,13 +1370,13 @@ ClockLatency PulseCapture::getClockLatency()
err = pa_stream_get_latency(mStream, &latency, &neg);
}
- if UNLIKELY(err != 0)
+ if(err != 0) [[alunlikely]]
{
ERR("Failed to get stream latency: 0x%x\n", err);
latency = 0;
neg = 0;
}
- else if UNLIKELY(neg)
+ else if(neg) [[alunlikely]]
latency = 0;
ret.Latency = std::chrono::microseconds{latency};