All pastes #2133558 Raw Edit

Stuff

public text v1 · immutable
#2133558 ·published 2012-03-29 14:52 UTC
rendered paste body
diff --git a/mod/box/tree.m b/mod/box/tree.m
index c1b75a3..d908340 100644
--- a/mod/box/tree.m
+++ b/mod/box/tree.m
@@ -55,11 +55,8 @@ u64_cmp(u64 a, u64 b)
 static inline int
 ta_cmp(struct box_tuple *tuple_a, struct box_tuple *tuple_b)
 {
-       if (!tuple_a)
-               return 0;
-       if (!tuple_b)
-               return 0;
-       return tuple_a < tuple_b ? -1 : (tuple_a > tuple_b);
+       ptrdiff_t result = tuple_a - tuple_b;
+       return result >> (sizeof(result) * 8 - 1);
 }
 
 /* }}} */