X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Futils%2FFastMutInt.lhs;h=b483a1428edf30bc592e3fd9e4361d8f25447054;hb=721d0619d9844c20271305f8281b6282c6988835;hp=bb12422cdb65e6b09929abf696c1008c24eb5852;hpb=48d756d4e70ef2fd03d45f9d1b3c0ea2f6cb8c01;p=ghc-hetmet.git diff --git a/ghc/compiler/utils/FastMutInt.lhs b/ghc/compiler/utils/FastMutInt.lhs index bb12422..b483a14 100644 --- a/ghc/compiler/utils/FastMutInt.lhs +++ b/ghc/compiler/utils/FastMutInt.lhs @@ -7,8 +7,7 @@ \begin{code} module FastMutInt( FastMutInt, newFastMutInt, - readFastMutInt, writeFastMutInt, - incFastMutInt, incFastMutIntBy + readFastMutInt, writeFastMutInt ) where #include "MachDeps.h" @@ -25,6 +24,10 @@ import PrelIOBase import GHC.Base import GHC.IOBase #endif + +#if __GLASGOW_HASKELL__ < 411 +newByteArray# = newCharArray# +#endif \end{code} \begin{code} @@ -46,18 +49,6 @@ writeFastMutInt :: FastMutInt -> Int -> IO () writeFastMutInt (FastMutInt arr) (I# i) = IO $ \s -> case writeIntArray# arr 0# i s of { s -> (# s, () #) } - -incFastMutInt :: FastMutInt -> IO Int -- Returns original value -incFastMutInt (FastMutInt arr) = IO $ \s -> - case readIntArray# arr 0# s of { (# s, i #) -> - case writeIntArray# arr 0# (i +# 1#) s of { s -> - (# s, I# i #) } } - -incFastMutIntBy :: FastMutInt -> Int -> IO Int -- Returns original value -incFastMutIntBy (FastMutInt arr) (I# n) = IO $ \s -> - case readIntArray# arr 0# s of { (# s, i #) -> - case writeIntArray# arr 0# (i +# n) s of { s -> - (# s, I# i #) } } \end{code} #endif