From 08e3ae0453c0a06a14b2bf0eedd4f843867982a0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 15 Feb 2013 01:08:22 -0600 Subject: gras: more fun with branch hints in allocator --- lib/theron_allocator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/theron_allocator.cpp b/lib/theron_allocator.cpp index 8a654f3..9db9367 100644 --- a/lib/theron_allocator.cpp +++ b/lib/theron_allocator.cpp @@ -54,10 +54,10 @@ static struct WorkerAllocator : Theron::IAllocator void *Allocate(const SizeType size) { - if (size <= MY_ALLOCATOR_CHUNK_SIZE) + if GRAS_LIKELY(size <= MY_ALLOCATOR_CHUNK_SIZE) { mSpinLock.Lock(); - if (queue.empty()) + if GRAS_UNLIKELY(queue.empty()) { unwanted_malloc_count++; mSpinLock.Unlock(); @@ -78,7 +78,7 @@ static struct WorkerAllocator : Theron::IAllocator void Free(void *const memory) { const bool in_pool = ptrdiff_t(memory) >= ptrdiff_t(pool) and ptrdiff_t(memory) < pool_end; - if (in_pool) + if GRAS_LIKELY(in_pool) { mSpinLock.Lock(); queue.push_front(memory); -- cgit