summaryrefslogtreecommitdiff
path: root/src/protocols/CTMControl.cpp
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2025-01-17 18:21:34 +0100
committervaxerski <vaxry@vaxry.net>2025-01-17 18:56:39 +0100
commitb7a3c4526990d6601ff2cac748ff860cda6bc16d (patch)
tree425c6afa0bc35f7f370a666bd7a81214a6e9475a /src/protocols/CTMControl.cpp
parent2bad73354a5dbb9be8ba9a39b6238017a216a25b (diff)
core: add LIKELY and UNLIKELY macros
helps the compiler optimize
Diffstat (limited to 'src/protocols/CTMControl.cpp')
-rw-r--r--src/protocols/CTMControl.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/protocols/CTMControl.cpp b/src/protocols/CTMControl.cpp
index 91e05ac4..91f4501f 100644
--- a/src/protocols/CTMControl.cpp
+++ b/src/protocols/CTMControl.cpp
@@ -7,7 +7,7 @@
#include "../helpers/Monitor.hpp"
CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlManagerV1> resource_) : resource(resource_) {
- if (!good())
+ if UNLIKELY (!good())
return;
resource->setDestroy([this](CHyprlandCtmControlManagerV1* pMgr) { PROTO::ctm->destroyResource(this); });
@@ -17,12 +17,12 @@ CHyprlandCTMControlResource::CHyprlandCTMControlResource(SP<CHyprlandCtmControlM
wl_fixed_t mat5, wl_fixed_t mat6, wl_fixed_t mat7, wl_fixed_t mat8) {
const auto OUTPUTRESOURCE = CWLOutputResource::fromResource(output);
- if (!OUTPUTRESOURCE)
+ if UNLIKELY (!OUTPUTRESOURCE)
return; // ?!
const auto PMONITOR = OUTPUTRESOURCE->monitor.lock();
- if (!PMONITOR)
+ if UNLIKELY (!PMONITOR)
return; // ?!?!
const std::array<float, 9> MAT = {wl_fixed_to_double(mat0), wl_fixed_to_double(mat1), wl_fixed_to_double(mat2), wl_fixed_to_double(mat3), wl_fixed_to_double(mat4),
@@ -72,7 +72,7 @@ void CHyprlandCTMControlProtocol::bindManager(wl_client* client, void* data, uin
const auto RESOURCE = m_vManagers.emplace_back(makeShared<CHyprlandCTMControlResource>(makeShared<CHyprlandCtmControlManagerV1>(client, ver, id)));
- if (!RESOURCE->good()) {
+ if UNLIKELY (!RESOURCE->good()) {
wl_client_post_no_memory(client);
m_vManagers.pop_back();
return;