core: add LIKELY and UNLIKELY macros

helps the compiler optimize
This commit is contained in:
vaxerski
2025-01-17 18:21:34 +01:00
parent 2bad73354a
commit b7a3c45269
58 changed files with 395 additions and 396 deletions

View File

@@ -15,7 +15,7 @@ bool CAlphaModifier::good() {
void CAlphaModifier::setResource(SP<CWpAlphaModifierSurfaceV1> resource) {
m_pResource = std::move(resource);
if (!m_pResource->resource())
if UNLIKELY (!m_pResource->resource())
return;
m_pResource->setDestroy([this](CWpAlphaModifierSurfaceV1* resource) { destroy(); });
@@ -98,7 +98,7 @@ void CAlphaModifierProtocol::getSurface(CWpAlphaModifierV1* manager, uint32_t id
.first->second.get();
}
if (!alphaModifier->good()) {
if UNLIKELY (!alphaModifier->good()) {
manager->noMemory();
m_mAlphaModifiers.erase(surface);
}