3 -- (c) The University of Glasgow 2002-2006
5 -- Unboxed mutable Ints
9 FastMutInt, newFastMutInt,
10 readFastMutInt, writeFastMutInt
16 #define SIZEOF_HSINT INT_SIZE_IN_BYTES
25 #ifdef __GLASGOW_HASKELL__
26 data FastMutInt = FastMutInt (MutableByteArray# RealWorld)
28 newFastMutInt :: IO FastMutInt
29 newFastMutInt = IO $ \s ->
30 case newByteArray# size s of { (# s, arr #) ->
31 (# s, FastMutInt arr #) }
32 where I# size = SIZEOF_HSINT
34 readFastMutInt :: FastMutInt -> IO Int
35 readFastMutInt (FastMutInt arr) = IO $ \s ->
36 case readIntArray# arr 0# s of { (# s, i #) ->
39 writeFastMutInt :: FastMutInt -> Int -> IO ()
40 writeFastMutInt (FastMutInt arr) (I# i) = IO $ \s ->
41 case writeIntArray# arr 0# i s of { s ->