Skip to content

Commit 3d3fc98

Browse files
Make it build on WASM again.
1 parent a12f5bd commit 3d3fc98

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

System/Metrics/Distribution.hsc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ import Data.Array
4444
import System.Metrics.Distribution.Internal (Stats(..))
4545
import System.Metrics.ThreadId
4646

47+
-- Three cases for these definitions
48+
-- 64-bit, GHC has Int64
49+
-- 64-bit, GHC doesn't have Int64
50+
-- 32-bit
51+
4752
-- 64-bit machine, Int ~ Int64, do it the fast way:
4853
#if SIZEOF_HSINT == 8
4954

@@ -87,7 +92,25 @@ writeInt64Array = writeIntArray##
8792
#endif
8893

8994
#else
95+
-- NB: I've only tested these with the WASM backend:
96+
97+
intToInt64 :: Int## -> Int64##
98+
intToInt64 = intToInt64##
99+
100+
plusInt64 :: Int64## -> Int64## -> Int64##
101+
plusInt64 = plusInt64##
102+
103+
eqInt64 :: Int64## -> Int64## -> Int##
104+
eqInt64 = eqInt64##
105+
106+
readInt64Array :: MutableByteArray## d -> Int## -> State## d -> (## State## d, Int64## ##)
107+
readInt64Array = readInt64Array##
108+
109+
writeInt64Array :: MutableByteArray## d -> Int## -> Int64## -> State## d -> State## d
110+
writeInt64Array = writeInt64Array##
111+
90112
-- I don't know a better way on 32-bit machines...
113+
int64ToDouble :: Int64## -> Double##
91114
int64ToDouble i =
92115
case fromIntegral (I64## i) of (D## d) -> d
93116
#endif

0 commit comments

Comments
 (0)