]> git.saurik.com Git - redis.git/blame - deps/jemalloc/src/extent.c
Jemalloc updated to 3.0.0.
[redis.git] / deps / jemalloc / src / extent.c
CommitLineData
a78e148b 1#define JEMALLOC_EXTENT_C_
2#include "jemalloc/internal/jemalloc_internal.h"
3
4/******************************************************************************/
5
a78e148b 6static inline int
7extent_szad_comp(extent_node_t *a, extent_node_t *b)
8{
9 int ret;
10 size_t a_size = a->size;
11 size_t b_size = b->size;
12
13 ret = (a_size > b_size) - (a_size < b_size);
14 if (ret == 0) {
15 uintptr_t a_addr = (uintptr_t)a->addr;
16 uintptr_t b_addr = (uintptr_t)b->addr;
17
18 ret = (a_addr > b_addr) - (a_addr < b_addr);
19 }
20
21 return (ret);
22}
23
24/* Generate red-black tree functions. */
25rb_gen(, extent_tree_szad_, extent_tree_t, extent_node_t, link_szad,
26 extent_szad_comp)
a78e148b 27
28static inline int
29extent_ad_comp(extent_node_t *a, extent_node_t *b)
30{
31 uintptr_t a_addr = (uintptr_t)a->addr;
32 uintptr_t b_addr = (uintptr_t)b->addr;
33
34 return ((a_addr > b_addr) - (a_addr < b_addr));
35}
36
37/* Generate red-black tree functions. */
38rb_gen(, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad,
39 extent_ad_comp)