Removed dead code from a macro in zmalloc.cpp
I think the compiler would have removed this no-op anyways but it definitely wasted me some 30 minutes on this :( I was hoping I could remove the branch through some bit-hacking but apparently its dead code :). Oh well, its 30 minutes of refreshing bit hacking. Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com> Former-commit-id: 8171e6de13311e3ad2e87c32d63060dcf3bd6055
This commit is contained in:
parent
71da0d44a5
commit
bb67320752
@ -83,17 +83,8 @@ static_assert((PREFIX_SIZE % 16) == 0, "Our prefix must be modulo 16-bytes or ou
|
|||||||
#define realloc(ptr,size,type) realloc(ptr,size)
|
#define realloc(ptr,size,type) realloc(ptr,size)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define update_zmalloc_stat_alloc(__n) do { \
|
#define update_zmalloc_stat_alloc(__n) atomicIncr(used_memory,(__n))
|
||||||
size_t _n = (__n); \
|
#define update_zmalloc_stat_free(__n) atomicDecr(used_memory,(__n))
|
||||||
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
|
|
||||||
atomicIncr(used_memory,__n); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
#define update_zmalloc_stat_free(__n) do { \
|
|
||||||
size_t _n = (__n); \
|
|
||||||
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
|
|
||||||
atomicDecr(used_memory,__n); \
|
|
||||||
} while(0)
|
|
||||||
|
|
||||||
static size_t used_memory = 0;
|
static size_t used_memory = 0;
|
||||||
pthread_mutex_t used_memory_mutex = PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t used_memory_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user