From f069d081be57d720d8bff16331212891a4f5def8 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Mon, 22 Aug 2011 10:00:03 -0400 Subject: [PATCH] ck_hp: Branch-free compare (contributed by Degski). --- src/ck_hp.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/ck_hp.c b/src/ck_hp.c index 5e941fb..d31637c 100644 --- a/src/ck_hp.c +++ b/src/ck_hp.c @@ -154,14 +154,7 @@ hazard_compare(const void *a, const void *b) x = a; y = b; - - if (*x < *y) { - return -1; - } else if (*x == *y) { - return 0; - } - - return 1; + return ((*x > *y) - (*x < *y)); } CK_CC_INLINE static bool