[Git][ghc/ghc][master] nonmoving: Optimise log2_ceil
Marge Bot
gitlab at gitlab.haskell.org
Mon Jun 1 10:35:09 UTC 2020
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
f945eea5 by Ben Gamari at 2020-06-01T06:34:58-04:00
nonmoving: Optimise log2_ceil
- - - - -
1 changed file:
- rts/sm/NonMoving.c
Changes:
=====================================
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.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f945eea569993a4e5ed953f4573e6eab785f309f
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f945eea569993a4e5ed953f4573e6eab785f309f
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200601/d23c22fc/attachment-0001.html>
More information about the ghc-commits
mailing list