module Z.Data.PrimRef.PrimIORef
(
PrimIORef
, newPrimIORef
, readPrimIORef
, writePrimIORef
, modifyPrimIORef
, Counter
, newCounter
, atomicAddCounter
, atomicSubCounter
, atomicAndCounter
, atomicNandCounter
, atomicOrCounter
, atomicXorCounter
, atomicAddCounter'
, atomicSubCounter'
, atomicAndCounter'
, atomicNandCounter'
, atomicOrCounter'
, atomicXorCounter'
, atomicAddCounter_
, atomicSubCounter_
, atomicAndCounter_
, atomicNandCounter_
, atomicOrCounter_
, atomicXorCounter_
) where
import Data.Primitive.Types
import Data.Primitive.ByteArray
import GHC.Exts
import GHC.IO
import Z.Data.PrimRef.PrimSTRef
newtype PrimIORef a = PrimIORef (PrimSTRef RealWorld a)
newPrimIORef :: Prim a => a -> IO (PrimIORef a)
newPrimIORef :: a -> IO (PrimIORef a)
newPrimIORef a
x = PrimSTRef RealWorld a -> PrimIORef a
forall k (a :: k). PrimSTRef RealWorld a -> PrimIORef a
PrimIORef (PrimSTRef RealWorld a -> PrimIORef a)
-> IO (PrimSTRef RealWorld a) -> IO (PrimIORef a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` ST RealWorld (PrimSTRef RealWorld a) -> IO (PrimSTRef RealWorld a)
forall a. ST RealWorld a -> IO a
stToIO (a -> ST RealWorld (PrimSTRef RealWorld a)
forall a s. Prim a => a -> ST s (PrimSTRef s a)
newPrimSTRef a
x)
{-# INLINE newPrimIORef #-}
readPrimIORef :: Prim a => PrimIORef a -> IO a
readPrimIORef :: PrimIORef a -> IO a
readPrimIORef (PrimIORef PrimSTRef RealWorld a
ref) = ST RealWorld a -> IO a
forall a. ST RealWorld a -> IO a
stToIO (PrimSTRef RealWorld a -> ST RealWorld a
forall a s. Prim a => PrimSTRef s a -> ST s a
readPrimSTRef PrimSTRef RealWorld a
ref)
{-# INLINE readPrimIORef #-}
writePrimIORef :: Prim a => PrimIORef a -> a -> IO ()
writePrimIORef :: PrimIORef a -> a -> IO ()
writePrimIORef (PrimIORef PrimSTRef RealWorld a
ref) a
x = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (PrimSTRef RealWorld a -> a -> ST RealWorld ()
forall a s. Prim a => PrimSTRef s a -> a -> ST s ()
writePrimSTRef PrimSTRef RealWorld a
ref a
x)
{-# INLINE writePrimIORef #-}
modifyPrimIORef :: Prim a => PrimIORef a -> (a -> a) -> IO ()
modifyPrimIORef :: PrimIORef a -> (a -> a) -> IO ()
modifyPrimIORef PrimIORef a
ref a -> a
f = PrimIORef a -> IO a
forall a. Prim a => PrimIORef a -> IO a
readPrimIORef PrimIORef a
ref IO a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= PrimIORef a -> a -> IO ()
forall a. Prim a => PrimIORef a -> a -> IO ()
writePrimIORef PrimIORef a
ref (a -> IO ()) -> (a -> a) -> a -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> a
f
{-# INLINE modifyPrimIORef #-}
type Counter = PrimIORef Int
newCounter :: Int -> IO Counter
newCounter :: Int -> IO Counter
newCounter = Int -> IO Counter
forall a. Prim a => a -> IO (PrimIORef a)
newPrimIORef
{-# INLINE newCounter #-}
atomicAddCounter' :: Counter -> Int -> IO Int
atomicAddCounter' :: Counter -> Int -> IO Int
atomicAddCounter' (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchAddIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# (Int#
res# Int# -> Int# -> Int#
+# Int#
x#)) #)
atomicAddCounter :: Counter -> Int -> IO Int
atomicAddCounter :: Counter -> Int -> IO Int
atomicAddCounter (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchAddIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# Int#
res#) #)
atomicAddCounter_ :: Counter -> Int -> IO ()
atomicAddCounter_ :: Counter -> Int -> IO ()
atomicAddCounter_ (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
_ #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchAddIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, () #)
{-# INLINE atomicAddCounter_ #-}
atomicSubCounter' :: Counter -> Int -> IO Int
atomicSubCounter' :: Counter -> Int -> IO Int
atomicSubCounter' (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchSubIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# (Int#
res# Int# -> Int# -> Int#
-# Int#
x#)) #)
atomicSubCounter :: Counter -> Int -> IO Int
atomicSubCounter :: Counter -> Int -> IO Int
atomicSubCounter (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchSubIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# Int#
res#) #)
atomicSubCounter_ :: Counter -> Int -> IO ()
atomicSubCounter_ :: Counter -> Int -> IO ()
atomicSubCounter_ (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
_ #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchSubIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, () #)
{-# INLINE atomicSubCounter_ #-}
atomicAndCounter' :: Counter -> Int -> IO Int
atomicAndCounter' :: Counter -> Int -> IO Int
atomicAndCounter' (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchAndIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# (Int#
res# Int# -> Int# -> Int#
`andI#` Int#
x#)) #)
{-# INLINE atomicAndCounter' #-}
atomicAndCounter :: Counter -> Int -> IO Int
atomicAndCounter :: Counter -> Int -> IO Int
atomicAndCounter (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchAndIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# Int#
res#) #)
{-# INLINE atomicAndCounter #-}
atomicAndCounter_ :: Counter -> Int -> IO ()
atomicAndCounter_ :: Counter -> Int -> IO ()
atomicAndCounter_ (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
_ #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchAndIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, () #)
{-# INLINE atomicAndCounter_ #-}
atomicNandCounter' :: Counter -> Int -> IO Int
atomicNandCounter' :: Counter -> Int -> IO Int
atomicNandCounter' (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchNandIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# (Int# -> Int#
notI# (Int#
res# Int# -> Int# -> Int#
`andI#` Int#
x#))) #)
{-# INLINE atomicNandCounter' #-}
atomicNandCounter :: Counter -> Int -> IO Int
atomicNandCounter :: Counter -> Int -> IO Int
atomicNandCounter (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchNandIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# Int#
res#) #)
{-# INLINE atomicNandCounter #-}
atomicNandCounter_ :: Counter -> Int -> IO ()
atomicNandCounter_ :: Counter -> Int -> IO ()
atomicNandCounter_ (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
_ #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchNandIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, () #)
{-# INLINE atomicNandCounter_ #-}
atomicOrCounter' :: Counter -> Int -> IO Int
atomicOrCounter' :: Counter -> Int -> IO Int
atomicOrCounter' (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchOrIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# (Int#
res# Int# -> Int# -> Int#
`orI#` Int#
x#)) #)
{-# INLINE atomicOrCounter' #-}
atomicOrCounter :: Counter -> Int -> IO Int
atomicOrCounter :: Counter -> Int -> IO Int
atomicOrCounter (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchOrIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# Int#
res#) #)
{-# INLINE atomicOrCounter #-}
atomicOrCounter_ :: Counter -> Int -> IO ()
atomicOrCounter_ :: Counter -> Int -> IO ()
atomicOrCounter_ (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
_ #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchOrIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, () #)
{-# INLINE atomicOrCounter_ #-}
atomicXorCounter' :: Counter -> Int -> IO Int
atomicXorCounter' :: Counter -> Int -> IO Int
atomicXorCounter' (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchXorIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# (Int#
res# Int# -> Int# -> Int#
`xorI#` Int#
x#)) #)
{-# INLINE atomicXorCounter' #-}
atomicXorCounter :: Counter -> Int -> IO Int
atomicXorCounter :: Counter -> Int -> IO Int
atomicXorCounter (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int)
-> (State# RealWorld -> (# State# RealWorld, Int #)) -> IO Int
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
res# #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchXorIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, (Int# -> Int
I# Int#
res#) #)
{-# INLINE atomicXorCounter #-}
atomicXorCounter_ :: Counter -> Int -> IO ()
atomicXorCounter_ :: Counter -> Int -> IO ()
atomicXorCounter_ (PrimIORef (PrimSTRef (MutableByteArray MutableByteArray# RealWorld
mba#))) (I# Int#
x#) = (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a. (State# RealWorld -> (# State# RealWorld, a #)) -> IO a
IO ((State# RealWorld -> (# State# RealWorld, () #)) -> IO ())
-> (State# RealWorld -> (# State# RealWorld, () #)) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ State# RealWorld
s1# ->
let !(# State# RealWorld
s2#, Int#
_ #) = MutableByteArray# RealWorld
-> Int# -> Int# -> State# RealWorld -> (# State# RealWorld, Int# #)
forall d.
MutableByteArray# d
-> Int# -> Int# -> State# d -> (# State# d, Int# #)
fetchXorIntArray# MutableByteArray# RealWorld
mba# Int#
0# Int#
x# State# RealWorld
s1# in (# State# RealWorld
s2#, () #)
{-# INLINE atomicXorCounter_ #-}