@@ -3,6 +3,7 @@ module Main
33import Data.Bytes as B
44import Data.ByteArray as BA
55
6+-- %flag C "-g3 -ggdb -O0"
67%link C "array.o"
78
89initialBuf : Bytes
@@ -29,10 +30,10 @@ alloc x 0 = return x
2930alloc x i = do
3031 -- allocate an array
3132 arr <- BA.allocate (64 * 1024 * 1024)
32− -- write "i" at offset 0
33− BA.pokeInt 0 i arr
34− -- read number from offset 0
35− j <- BA.peekInt 0 arr
33+ -- write "i" at offset 63M
34+ BA.pokeInt (63*1024*1024) i arr
35+ -- read number from offset 63M
36+ j <- BA.peekInt (63*1024*1024) arr
3637 -- count matches
3738 alloc (x + if i == j then 1 else 0) (i - 1)
3839