summaryrefslogtreecommitdiff
path: root/deps/jemalloc/src/extent.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-06-25 12:29:24 +0200
committerantirez <antirez@gmail.com>2011-06-25 12:29:24 +0200
commit994ed2bc552f4114b1f0c8dd3fd8aefaec6beeae (patch)
tree16c7f8d3c7f050a5cda04488d48109ee7f02b6fb /deps/jemalloc/src/extent.c
parent45ec3243f8205ff8d356a5175026052070211d91 (diff)
parentd5b36c5114659e979fc2e102954ded1e30aacacf (diff)
downloadredis-994ed2bc552f4114b1f0c8dd3fd8aefaec6beeae.tar.gz
unstable merge conflicts resolved
Diffstat (limited to 'deps/jemalloc/src/extent.c')
-rw-r--r--deps/jemalloc/src/extent.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/deps/jemalloc/src/extent.c b/deps/jemalloc/src/extent.c
new file mode 100644
index 000000000..3c04d3aa5
--- /dev/null
+++ b/deps/jemalloc/src/extent.c
@@ -0,0 +1,41 @@
+#define JEMALLOC_EXTENT_C_
+#include "jemalloc/internal/jemalloc_internal.h"
+
+/******************************************************************************/
+
+#if (defined(JEMALLOC_SWAP) || defined(JEMALLOC_DSS))
+static inline int
+extent_szad_comp(extent_node_t *a, extent_node_t *b)
+{
+ int ret;
+ size_t a_size = a->size;
+ size_t b_size = b->size;
+
+ ret = (a_size > b_size) - (a_size < b_size);
+ if (ret == 0) {
+ uintptr_t a_addr = (uintptr_t)a->addr;
+ uintptr_t b_addr = (uintptr_t)b->addr;
+
+ ret = (a_addr > b_addr) - (a_addr < b_addr);
+ }
+
+ return (ret);
+}
+
+/* Generate red-black tree functions. */
+rb_gen(, extent_tree_szad_, extent_tree_t, extent_node_t, link_szad,
+ extent_szad_comp)
+#endif
+
+static inline int
+extent_ad_comp(extent_node_t *a, extent_node_t *b)
+{
+ uintptr_t a_addr = (uintptr_t)a->addr;
+ uintptr_t b_addr = (uintptr_t)b->addr;
+
+ return ((a_addr > b_addr) - (a_addr < b_addr));
+}
+
+/* Generate red-black tree functions. */
+rb_gen(, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad,
+ extent_ad_comp)