Permalink
Browse files

optimized rbnd() func

  • Loading branch information...
1 parent a278660 commit dbf20c1a975f50f587b8604ed617946e51e596fd @tony2001 tony2001 committed Feb 16, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 sort_common.h
View
@@ -51,7 +51,13 @@ static inline int compute_minrun(const uint64_t size) /* {{{ */
static inline size_t rbnd(size_t len) /* {{{ */
{
- return 1ULL << (63 - CLZ(len / (64 - CLZ(len))));
+ int k;
+ if (len < 16) {
+ return 2;
+ }
+
+ k = 62 - CLZ(len);
+ return 1ULL << ((2 * k) / 3);
}
/* }}} */

0 comments on commit dbf20c1

Please sign in to comment.