Skip to content

Commit

Permalink
handle 32 bit architectures ok
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellwrosen committed Oct 10, 2023
1 parent 98da2a9 commit 200b887
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/TimerWheel/Internal/Bucket.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE CPP #-}

-- Code from this implementation was cribbed from `psqueues`, whose license is copied below.
--
-- The Glasgow Haskell Compiler License
Expand Down Expand Up @@ -55,6 +57,8 @@ import Data.Bits
import TimerWheel.Internal.Prelude
import TimerWheel.Internal.Timestamp (Timestamp)

#include "MachDeps.h"

data Bucket a
= -- Invariants on `Bin k p v m l r`:
-- 1. `l` and `r` can't both be Nil
Expand Down Expand Up @@ -290,7 +294,7 @@ prefixMask m = -m `xor` m
{-# INLINE prefixMask #-}

onlyHighestBit :: Word64 -> Mask
onlyHighestBit w = unsafeShiftL 1 (63 - countLeadingZeros w)
onlyHighestBit w = unsafeShiftL 1 (WORD_SIZE_IN_BITS - 1 - countLeadingZeros w)
{-# INLINE onlyHighestBit #-}

i2w :: TimerId -> Word64
Expand Down
2 changes: 1 addition & 1 deletion timer-wheel.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ benchmark bench
random ^>= 1.2,
tasty-bench,
timer-wheel,
ghc-options: -fproc-alignment=64 -threaded "-with-rtsopts=-N2 -T -A32m"
ghc-options: -fproc-alignment=64 -rtsopts -threaded "-with-rtsopts=-N2 -T -A32m"
hs-source-dirs: bench
main-is: Main.hs
type: exitcode-stdio-1.0

0 comments on commit 200b887

Please sign in to comment.