]>
Commit | Line | Data |
---|---|---|
a78e148b | 1 | #define JEMALLOC_EXTENT_C_ |
2 | #include "jemalloc/internal/jemalloc_internal.h" | |
3 | ||
4 | /******************************************************************************/ | |
5 | ||
6 | #if (defined(JEMALLOC_SWAP) || defined(JEMALLOC_DSS)) | |
7 | static inline int | |
8 | extent_szad_comp(extent_node_t *a, extent_node_t *b) | |
9 | { | |
10 | int ret; | |
11 | size_t a_size = a->size; | |
12 | size_t b_size = b->size; | |
13 | ||
14 | ret = (a_size > b_size) - (a_size < b_size); | |
15 | if (ret == 0) { | |
16 | uintptr_t a_addr = (uintptr_t)a->addr; | |
17 | uintptr_t b_addr = (uintptr_t)b->addr; | |
18 | ||
19 | ret = (a_addr > b_addr) - (a_addr < b_addr); | |
20 | } | |
21 | ||
22 | return (ret); | |
23 | } | |
24 | ||
25 | /* Generate red-black tree functions. */ | |
26 | rb_gen(, extent_tree_szad_, extent_tree_t, extent_node_t, link_szad, | |
27 | extent_szad_comp) | |
28 | #endif | |
29 | ||
30 | static inline int | |
31 | extent_ad_comp(extent_node_t *a, extent_node_t *b) | |
32 | { | |
33 | uintptr_t a_addr = (uintptr_t)a->addr; | |
34 | uintptr_t b_addr = (uintptr_t)b->addr; | |
35 | ||
36 | return ((a_addr > b_addr) - (a_addr < b_addr)); | |
37 | } | |
38 | ||
39 | /* Generate red-black tree functions. */ | |
40 | rb_gen(, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad, | |
41 | extent_ad_comp) |