summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-02-05 10:50:59 (GMT)
committerJason Evans <jasone@canonware.com>2017-02-09 02:50:03 (GMT)
commit650c070e102daeedd643dc79b463603a1ea18497 (patch)
treec21fd233c4d260013e8df9191b7d670af7cec403 /test
parentf5cf9b19c85f88ee91b3caf65e2a6d70f4548f31 (diff)
downloadjemalloc-650c070e102daeedd643dc79b463603a1ea18497.zip
jemalloc-650c070e102daeedd643dc79b463603a1ea18497.tar.gz
jemalloc-650c070e102daeedd643dc79b463603a1ea18497.tar.bz2
Remove rtree support for 0 (NULL) keys.
NULL can never actually be inserted in practice, and removing support allows a branch to be removed from the fast path.
Diffstat (limited to 'test')
-rw-r--r--test/unit/rtree.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/unit/rtree.c b/test/unit/rtree.c
index 2088595..488fd54 100644
--- a/test/unit/rtree.c
+++ b/test/unit/rtree.c
@@ -40,7 +40,7 @@ TEST_BEGIN(test_rtree_read_empty) {
rtree_ctx_t rtree_ctx = RTREE_CTX_INITIALIZER;
test_rtree = &rtree;
assert_false(rtree_new(&rtree), "Unexpected rtree_new() failure");
- assert_ptr_null(rtree_read(tsdn, &rtree, &rtree_ctx, 0, false),
+ assert_ptr_null(rtree_read(tsdn, &rtree, &rtree_ctx, PAGE, false),
"rtree_read() should return NULL for empty tree");
rtree_delete(tsdn, &rtree);
test_rtree = NULL;
@@ -139,9 +139,10 @@ TEST_BEGIN(test_rtree_extrema) {
test_rtree = &rtree;
assert_false(rtree_new(&rtree), "Unexpected rtree_new() failure");
- assert_false(rtree_write(tsdn, &rtree, &rtree_ctx, 0, &extent_a),
+ assert_false(rtree_write(tsdn, &rtree, &rtree_ctx, PAGE, &extent_a),
"Unexpected rtree_write() failure");
- assert_ptr_eq(rtree_read(tsdn, &rtree, &rtree_ctx, 0, true), &extent_a,
+ assert_ptr_eq(rtree_read(tsdn, &rtree, &rtree_ctx, PAGE, true),
+ &extent_a,
"rtree_read() should return previously set value");
assert_false(rtree_write(tsdn, &rtree, &rtree_ctx, ~((uintptr_t)0),
@@ -158,7 +159,8 @@ TEST_END
TEST_BEGIN(test_rtree_bits) {
tsdn_t *tsdn = tsdn_fetch();
- uintptr_t keys[] = {0, 1, (((uintptr_t)1) << LG_PAGE) - 1};
+ uintptr_t keys[] = {PAGE, PAGE + 1,
+ PAGE + (((uintptr_t)1) << LG_PAGE) - 1};
extent_t extent;
rtree_t rtree;
@@ -180,7 +182,7 @@ TEST_BEGIN(test_rtree_bits) {
"key=%#"FMTxPTR, i, j, keys[i], keys[j]);
}
assert_ptr_null(rtree_read(tsdn, &rtree, &rtree_ctx,
- (((uintptr_t)1) << LG_PAGE), false),
+ (((uintptr_t)2) << LG_PAGE), false),
"Only leftmost rtree leaf should be set; i=%u", i);
rtree_clear(tsdn, &rtree, &rtree_ctx, keys[i]);
}