Regarding usage of UTILS_LIKELY
/UTILS_UNLIKELY
#7959
-
Hello. When browsing through the code I noticed a lot of For example, here, when creating a material instance (https://github.com/google/filament/blob/main/filament/src/details/Engine.cpp#L808): FMaterialInstance* FEngine::createMaterialInstance(const FMaterial* material,
const FMaterialInstance* other, const char* name) noexcept {
FMaterialInstance* p = mHeapAllocator.make<FMaterialInstance>(*this, other, name);
if (UTILS_UNLIKELY(p)) { // should never happen
auto pos = mMaterialInstances.emplace(material, "MaterialInstance");
pos.first->second.insert(p);
}
return p;
} This if (__builtin_expect (p, false)) {
// ...
} The branch here is marked as unlikely (as in, we expect it to be @pixelflinger I saw that your commit added it, can you explain? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Oh that definitely looks like a mistake. |
Beta Was this translation helpful? Give feedback.
Oh that definitely looks like a mistake.