summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-05-15 12:16:05 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-06-01 06:34:58 -0400
commitf945eea569993a4e5ed953f4573e6eab785f309f (patch)
treee6c539709226aca4efed512185d018df21d4fab0 /rts
parentd412d7a3783b4fc5d3078541a60996e249b4157c (diff)
downloadhaskell-f945eea569993a4e5ed953f4573e6eab785f309f.tar.gz
nonmoving: Optimise log2_ceil
Diffstat (limited to 'rts')
-rw-r--r--rts/sm/NonMoving.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/rts/sm/NonMoving.c b/rts/sm/NonMoving.c
index 99c639fb30..09945ce776 100644
--- a/rts/sm/NonMoving.c
+++ b/rts/sm/NonMoving.c
@@ -586,15 +586,9 @@ static struct NonmovingSegment *nonmovingAllocSegment(uint32_t node)
return ret;
}
-static inline unsigned long log2_floor(unsigned long x)
-{
- return sizeof(unsigned long)*8 - 1 - __builtin_clzl(x);
-}
-
static inline unsigned long log2_ceil(unsigned long x)
{
- unsigned long log = log2_floor(x);
- return (x - (1 << log)) ? log + 1 : log;
+ return (sizeof(unsigned long)*8) - __builtin_clzl(x-1);
}
// Advance a segment's next_free pointer. Returns true if segment if full.