diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-10-22 07:25:53 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-10-22 07:25:53 +0400 |
commit | a4b27831693eed988bcdf957bbe9ad7609e7bdf7 (patch) | |
tree | 3494d520b807cf40ebfc32650b67e32e5287f723 /intern/container/CTR_HashedPtr.h | |
parent | 226a5ee83446f91cfeccc73912de85e89fe2169f (diff) |
small optimization for BLI_heap(), give some speedup in decimeter.
- use unsigned ints only (where mixing signed/unsigned)
- turn heap_swap into an inline function, add SWAP_TVAL macro to swap values using a temp value as storage.
- added type checking SHIFT3/4 macros
also style cleanup for CTR_Map
Diffstat (limited to 'intern/container/CTR_HashedPtr.h')
-rw-r--r-- | intern/container/CTR_HashedPtr.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/intern/container/CTR_HashedPtr.h b/intern/container/CTR_HashedPtr.h index 8d0ad2bb2a3..b7ac460f270 100644 --- a/intern/container/CTR_HashedPtr.h +++ b/intern/container/CTR_HashedPtr.h @@ -43,12 +43,19 @@ inline unsigned int CTR_Hash(void *inDWord) class CTR_HashedPtr { - void* m_valptr; + void *m_valptr; public: - CTR_HashedPtr(void* val) : m_valptr(val) {}; - unsigned int hash() const { return CTR_Hash(m_valptr);}; - inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) { return rhs.m_valptr == lhs.m_valptr;}; - void *getValue() const { return m_valptr; } + CTR_HashedPtr(void *val) : m_valptr(val) { + }; + unsigned int hash() const { + return CTR_Hash(m_valptr); + }; + inline friend bool operator ==(const CTR_HashedPtr & rhs, const CTR_HashedPtr & lhs) { + return rhs.m_valptr == lhs.m_valptr; + }; + void *getValue() const { + return m_valptr; + } }; #endif /* __CTR_HASHEDPTR_H__ */ |