core: add LIKELY and UNLIKELY macros
helps the compiler optimize
This commit is contained in:
parent
2bad73354a
commit
b7a3c45269
58 changed files with 395 additions and 396 deletions
|
|
@ -4,7 +4,7 @@
|
|||
#include <algorithm>
|
||||
|
||||
CRelativePointer::CRelativePointer(SP<CZwpRelativePointerV1> resource_) : resource(resource_) {
|
||||
if (!resource_->resource())
|
||||
if UNLIKELY (!resource_->resource())
|
||||
return;
|
||||
|
||||
pClient = resource->client();
|
||||
|
|
@ -50,7 +50,7 @@ void CRelativePointerProtocol::onGetRelativePointer(CZwpRelativePointerManagerV1
|
|||
const auto CLIENT = pMgr->client();
|
||||
const auto RESOURCE = m_vRelativePointers.emplace_back(std::make_unique<CRelativePointer>(makeShared<CZwpRelativePointerV1>(CLIENT, pMgr->version(), id))).get();
|
||||
|
||||
if (!RESOURCE->good()) {
|
||||
if UNLIKELY (!RESOURCE->good()) {
|
||||
pMgr->noMemory();
|
||||
m_vRelativePointers.pop_back();
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue