diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-05-15 12:16:05 -0400 |
---|---|---|
committer | Ben Gamari <ben@well-typed.com> | 2020-05-27 13:48:01 -0400 |
commit | d0c7ac1412b13c8f77bcd4b4188d8c8f34b9c547 (patch) | |
tree | b782b440b4e4c3287b0568b6392c0fad4eafe53d | |
parent | d6203f24cf421749616a247c047a9b44192f963a (diff) | |
download | haskell-d0c7ac1412b13c8f77bcd4b4188d8c8f34b9c547.tar.gz |
nonmoving: Optimise log2_ceilwip/gc/opt-log2-ceil
-rw-r--r-- | rts/sm/NonMoving.c | 8 |
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. |