module FlatParse.Basic.Integers
(
anyWord8, anyWord16, anyWord32, anyWord64
, anyInt8, anyInt16, anyInt32, anyInt64
, anyWord, anyInt
, anyWord16le, anyWord16be
, anyWord32le, anyWord32be
, anyWord64le, anyWord64be
, anyInt16le, anyInt16be
, anyInt32le, anyInt32be
, anyInt64le, anyInt64be
, word8
, withAnyWord8, withAnyWord16, withAnyWord32, withAnyWord64
, withAnyInt8, withAnyInt16, withAnyInt32, withAnyInt64
, withAnyWord, withAnyInt
, anyWord8Unsafe
, word8Unsafe, word16Unsafe, word32Unsafe, word64Unsafe
, withAnySized#, withAnySizedUnsafe#
, sizedUnsafe#
) where
import FlatParse.Basic.Parser
import FlatParse.Basic.Base ( withEnsure# )
import FlatParse.Common.Assorted ( word16ToInt16, word32ToInt32, word64ToInt64 )
import FlatParse.Common.GHCExts
import GHC.Word
import GHC.Int
import Control.Applicative ( Alternative(empty) )
withAnySized#
:: Int# -> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySized# :: forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySized# Int#
size# Addr# -> Int# -> a
indexOffAddr a -> ParserT st e r
p =
forall (st :: ZeroBitType) e r.
Int# -> ParserT st e r -> ParserT st e r
withEnsure# Int#
size# (forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySizedUnsafe# Int#
size# Addr# -> Int# -> a
indexOffAddr a -> ParserT st e r
p)
{-# inline withAnySized# #-}
withAnySizedUnsafe#
:: Int# -> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySizedUnsafe# :: forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySizedUnsafe# Int#
size# Addr# -> Int# -> a
indexOffAddr a -> ParserT st e r
p = forall (st :: ZeroBitType) e a.
(ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a)
-> ParserT st e a
ParserT \ForeignPtrContents
fp Addr#
eob Addr#
buf st
st ->
let a :: a
a = Addr# -> Int# -> a
indexOffAddr Addr#
buf Int#
0#
buf' :: Addr#
buf' = Addr# -> Int# -> Addr#
plusAddr# Addr#
buf Int#
size#
in forall (st :: ZeroBitType) e a.
ParserT st e a
-> ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a
runParserT# (a -> ParserT st e r
p a
a) ForeignPtrContents
fp Addr#
eob Addr#
buf' st
st
{-# inline withAnySizedUnsafe# #-}
withAnyWord8 :: (Word8 -> ParserT st e r) -> ParserT st e r
withAnyWord8 :: forall (st :: ZeroBitType) e r.
(Word8 -> ParserT st e r) -> ParserT st e r
withAnyWord8 Word8 -> ParserT st e r
p = forall (st :: ZeroBitType) e a.
(ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a)
-> ParserT st e a
ParserT \ForeignPtrContents
fp Addr#
eob Addr#
buf st
st -> case Addr# -> Addr# -> Int#
eqAddr# Addr#
eob Addr#
buf of
Int#
1# -> forall (st :: ZeroBitType) e a. st -> Res# st e a
Fail# st
st
Int#
_ -> let w# :: Word8#
w# = Addr# -> Int# -> Word8#
indexWord8OffAddr# Addr#
buf Int#
0#
in forall (st :: ZeroBitType) e a.
ParserT st e a
-> ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a
runParserT# (Word8 -> ParserT st e r
p (Word8# -> Word8
W8# Word8#
w#)) ForeignPtrContents
fp Addr#
eob (Addr# -> Int# -> Addr#
plusAddr# Addr#
buf Int#
1#) st
st
{-# inline withAnyWord8 #-}
withAnyWord16 :: (Word16 -> ParserT st e r) -> ParserT st e r
withAnyWord16 :: forall (st :: ZeroBitType) e r.
(Word16 -> ParserT st e r) -> ParserT st e r
withAnyWord16 = forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySized# Int#
2# (\Addr#
a Int#
i -> Word16# -> Word16
W16# (Addr# -> Int# -> Word16#
indexWord16OffAddr# Addr#
a Int#
i))
{-# inline withAnyWord16 #-}
withAnyWord32 :: (Word32 -> ParserT st e r) -> ParserT st e r
withAnyWord32 :: forall (st :: ZeroBitType) e r.
(Word32 -> ParserT st e r) -> ParserT st e r
withAnyWord32 = forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySized# Int#
4# (\Addr#
a Int#
i -> Word32# -> Word32
W32# (Addr# -> Int# -> Word32#
indexWord32OffAddr# Addr#
a Int#
i))
{-# inline withAnyWord32 #-}
withAnyWord64 :: (Word64 -> ParserT st e r) -> ParserT st e r
withAnyWord64 :: forall (st :: ZeroBitType) e r.
(Word64 -> ParserT st e r) -> ParserT st e r
withAnyWord64 = forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySized# Int#
8# (\Addr#
a Int#
i -> Word# -> Word64
W64# (Addr# -> Int# -> Word#
indexWord64OffAddr# Addr#
a Int#
i))
{-# inline withAnyWord64 #-}
withAnyInt8 :: (Int8 -> ParserT st e r) -> ParserT st e r
withAnyInt8 :: forall (st :: ZeroBitType) e r.
(Int8 -> ParserT st e r) -> ParserT st e r
withAnyInt8 Int8 -> ParserT st e r
p = forall (st :: ZeroBitType) e a.
(ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a)
-> ParserT st e a
ParserT \ForeignPtrContents
fp Addr#
eob Addr#
buf st
st -> case Addr# -> Addr# -> Int#
eqAddr# Addr#
eob Addr#
buf of
Int#
1# -> forall (st :: ZeroBitType) e a. st -> Res# st e a
Fail# st
st
Int#
_ -> let i# :: Int8#
i# = Addr# -> Int# -> Int8#
indexInt8OffAddr# Addr#
buf Int#
0#
in forall (st :: ZeroBitType) e a.
ParserT st e a
-> ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a
runParserT# (Int8 -> ParserT st e r
p (Int8# -> Int8
I8# Int8#
i#)) ForeignPtrContents
fp Addr#
eob (Addr# -> Int# -> Addr#
plusAddr# Addr#
buf Int#
1#) st
st
{-# inline withAnyInt8 #-}
withAnyInt16 :: (Int16 -> ParserT st e r) -> ParserT st e r
withAnyInt16 :: forall (st :: ZeroBitType) e r.
(Int16 -> ParserT st e r) -> ParserT st e r
withAnyInt16 = forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySized# Int#
2# (\Addr#
a Int#
i -> Int16# -> Int16
I16# (Addr# -> Int# -> Int16#
indexInt16OffAddr# Addr#
a Int#
i))
{-# inline withAnyInt16 #-}
withAnyInt32 :: (Int32 -> ParserT st e r) -> ParserT st e r
withAnyInt32 :: forall (st :: ZeroBitType) e r.
(Int32 -> ParserT st e r) -> ParserT st e r
withAnyInt32 = forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySized# Int#
4# (\Addr#
a Int#
i -> Int32# -> Int32
I32# (Addr# -> Int# -> Int32#
indexInt32OffAddr# Addr#
a Int#
i))
{-# inline withAnyInt32 #-}
withAnyInt64 :: (Int64 -> ParserT st e r) -> ParserT st e r
withAnyInt64 :: forall (st :: ZeroBitType) e r.
(Int64 -> ParserT st e r) -> ParserT st e r
withAnyInt64 = forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySized# Int#
8# (\Addr#
a Int#
i -> Int# -> Int64
I64# (Addr# -> Int# -> Int#
indexInt64OffAddr# Addr#
a Int#
i))
{-# inline withAnyInt64 #-}
withAnyWord :: (Word -> ParserT st e r) -> ParserT st e r
withAnyWord :: forall (st :: ZeroBitType) e r.
(Word -> ParserT st e r) -> ParserT st e r
withAnyWord Word -> ParserT st e r
p = forall (st :: ZeroBitType) e a.
(ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a)
-> ParserT st e a
ParserT \ForeignPtrContents
fp Addr#
eob Addr#
buf st
st -> case Int#
8# Int# -> Int# -> Int#
<=# Addr# -> Addr# -> Int#
minusAddr# Addr#
eob Addr#
buf of
Int#
0# -> forall (st :: ZeroBitType) e a. st -> Res# st e a
Fail# st
st
Int#
_ -> let w# :: Word#
w# = Addr# -> Int# -> Word#
indexWordOffAddr# Addr#
buf Int#
0#
in forall (st :: ZeroBitType) e a.
ParserT st e a
-> ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a
runParserT# (Word -> ParserT st e r
p (Word# -> Word
W# Word#
w#)) ForeignPtrContents
fp Addr#
eob (Addr# -> Int# -> Addr#
plusAddr# Addr#
buf Int#
8#) st
st
{-# inline withAnyWord #-}
withAnyInt :: (Int -> ParserT st e r) -> ParserT st e r
withAnyInt :: forall (st :: ZeroBitType) e r.
(Int -> ParserT st e r) -> ParserT st e r
withAnyInt Int -> ParserT st e r
p = forall (st :: ZeroBitType) e a.
(ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a)
-> ParserT st e a
ParserT \ForeignPtrContents
fp Addr#
eob Addr#
buf st
st -> case Int#
8# Int# -> Int# -> Int#
<=# Addr# -> Addr# -> Int#
minusAddr# Addr#
eob Addr#
buf of
Int#
0# -> forall (st :: ZeroBitType) e a. st -> Res# st e a
Fail# st
st
Int#
_ -> let i# :: Int#
i# = Addr# -> Int# -> Int#
indexIntOffAddr# Addr#
buf Int#
0#
in forall (st :: ZeroBitType) e a.
ParserT st e a
-> ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a
runParserT# (Int -> ParserT st e r
p (Int# -> Int
I# Int#
i#)) ForeignPtrContents
fp Addr#
eob (Addr# -> Int# -> Addr#
plusAddr# Addr#
buf Int#
8#) st
st
{-# inline withAnyInt #-}
anyWord8 :: ParserT st e Word8
anyWord8 :: forall (st :: ZeroBitType) e. ParserT st e Word8
anyWord8 = forall (st :: ZeroBitType) e r.
(Word8 -> ParserT st e r) -> ParserT st e r
withAnyWord8 forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyWord8 #-}
anyWord16 :: ParserT st e Word16
anyWord16 :: forall (st :: ZeroBitType) e. ParserT st e Word16
anyWord16 = forall (st :: ZeroBitType) e r.
(Word16 -> ParserT st e r) -> ParserT st e r
withAnyWord16 forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyWord16 #-}
anyWord32 :: ParserT st e Word32
anyWord32 :: forall (st :: ZeroBitType) e. ParserT st e Word32
anyWord32 = forall (st :: ZeroBitType) e r.
(Word32 -> ParserT st e r) -> ParserT st e r
withAnyWord32 forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyWord32 #-}
anyWord64 :: ParserT st e Word64
anyWord64 :: forall (st :: ZeroBitType) e. ParserT st e Word64
anyWord64 = forall (st :: ZeroBitType) e r.
(Word64 -> ParserT st e r) -> ParserT st e r
withAnyWord64 forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyWord64 #-}
anyInt8 :: ParserT st e Int8
anyInt8 :: forall (st :: ZeroBitType) e. ParserT st e Int8
anyInt8 = forall (st :: ZeroBitType) e r.
(Int8 -> ParserT st e r) -> ParserT st e r
withAnyInt8 forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyInt8 #-}
anyInt16 :: ParserT st e Int16
anyInt16 :: forall (st :: ZeroBitType) e. ParserT st e Int16
anyInt16 = forall (st :: ZeroBitType) e r.
(Int16 -> ParserT st e r) -> ParserT st e r
withAnyInt16 forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyInt16 #-}
anyInt32 :: ParserT st e Int32
anyInt32 :: forall (st :: ZeroBitType) e. ParserT st e Int32
anyInt32 = forall (st :: ZeroBitType) e r.
(Int32 -> ParserT st e r) -> ParserT st e r
withAnyInt32 forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyInt32 #-}
anyInt64 :: ParserT st e Int64
anyInt64 :: forall (st :: ZeroBitType) e. ParserT st e Int64
anyInt64 = forall (st :: ZeroBitType) e r.
(Int64 -> ParserT st e r) -> ParserT st e r
withAnyInt64 forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyInt64 #-}
anyWord :: ParserT st e Word
anyWord :: forall (st :: ZeroBitType) e. ParserT st e Word
anyWord = forall (st :: ZeroBitType) e r.
(Word -> ParserT st e r) -> ParserT st e r
withAnyWord forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyWord #-}
anyInt :: ParserT st e Int
anyInt :: forall (st :: ZeroBitType) e. ParserT st e Int
anyInt = forall (st :: ZeroBitType) e r.
(Int -> ParserT st e r) -> ParserT st e r
withAnyInt forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyInt #-}
anyWord16le :: ParserT st e Word16
#ifdef WORDS_BIGENDIAN
anyWord16le = withAnyWord16 (pure . byteSwap16)
#else
anyWord16le :: forall (st :: ZeroBitType) e. ParserT st e Word16
anyWord16le = forall (st :: ZeroBitType) e. ParserT st e Word16
anyWord16
#endif
{-# inline anyWord16le #-}
anyWord16be :: ParserT st e Word16
#ifdef WORDS_BIGENDIAN
anyWord16be = anyWord16
#else
anyWord16be :: forall (st :: ZeroBitType) e. ParserT st e Word16
anyWord16be = forall (st :: ZeroBitType) e r.
(Word16 -> ParserT st e r) -> ParserT st e r
withAnyWord16 (forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Word16
byteSwap16)
#endif
{-# inline anyWord16be #-}
anyWord32le :: ParserT st e Word32
#ifdef WORDS_BIGENDIAN
anyWord32le = withAnyWord32 (pure . byteSwap32)
#else
anyWord32le :: forall (st :: ZeroBitType) e. ParserT st e Word32
anyWord32le = forall (st :: ZeroBitType) e. ParserT st e Word32
anyWord32
#endif
{-# inline anyWord32le #-}
anyWord32be :: ParserT st e Word32
#ifdef WORDS_BIGENDIAN
anyWord32be = anyWord32
#else
anyWord32be :: forall (st :: ZeroBitType) e. ParserT st e Word32
anyWord32be = forall (st :: ZeroBitType) e r.
(Word32 -> ParserT st e r) -> ParserT st e r
withAnyWord32 (forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Word32
byteSwap32)
#endif
{-# inline anyWord32be #-}
anyWord64le :: ParserT st e Word64
#ifdef WORDS_BIGENDIAN
anyWord64le = withAnyWord64 (pure . byteSwap64)
#else
anyWord64le :: forall (st :: ZeroBitType) e. ParserT st e Word64
anyWord64le = forall (st :: ZeroBitType) e. ParserT st e Word64
anyWord64
#endif
{-# inline anyWord64le #-}
anyWord64be :: ParserT st e Word64
#ifdef WORDS_BIGENDIAN
anyWord64be = anyWord64
#else
anyWord64be :: forall (st :: ZeroBitType) e. ParserT st e Word64
anyWord64be = forall (st :: ZeroBitType) e r.
(Word64 -> ParserT st e r) -> ParserT st e r
withAnyWord64 (forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Word64
byteSwap64)
#endif
{-# inline anyWord64be #-}
anyInt16le :: ParserT st e Int16
#ifdef WORDS_BIGENDIAN
anyInt16le = withAnyWord16 (pure . word16ToInt16 . byteSwap16)
#else
anyInt16le :: forall (st :: ZeroBitType) e. ParserT st e Int16
anyInt16le = forall (st :: ZeroBitType) e. ParserT st e Int16
anyInt16
#endif
{-# inline anyInt16le #-}
anyInt16be :: ParserT st e Int16
#ifdef WORDS_BIGENDIAN
anyInt16be = anyInt16
#else
anyInt16be :: forall (st :: ZeroBitType) e. ParserT st e Int16
anyInt16be = forall (st :: ZeroBitType) e r.
(Word16 -> ParserT st e r) -> ParserT st e r
withAnyWord16 (forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Int16
word16ToInt16 forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word16 -> Word16
byteSwap16)
#endif
{-# inline anyInt16be #-}
anyInt32le :: ParserT st e Int32
#ifdef WORDS_BIGENDIAN
anyInt32le = withAnyWord32 (pure . word32ToInt32 . byteSwap32)
#else
anyInt32le :: forall (st :: ZeroBitType) e. ParserT st e Int32
anyInt32le = forall (st :: ZeroBitType) e. ParserT st e Int32
anyInt32
#endif
{-# inline anyInt32le #-}
anyInt32be :: ParserT st e Int32
#ifdef WORDS_BIGENDIAN
anyInt32be = anyInt32
#else
anyInt32be :: forall (st :: ZeroBitType) e. ParserT st e Int32
anyInt32be = forall (st :: ZeroBitType) e r.
(Word32 -> ParserT st e r) -> ParserT st e r
withAnyWord32 (forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Int32
word32ToInt32 forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word32 -> Word32
byteSwap32)
#endif
{-# inline anyInt32be #-}
anyInt64le :: ParserT st e Int64
#ifdef WORDS_BIGENDIAN
anyInt64le = withAnyWord64 (pure . word64ToInt64 . byteSwap64)
#else
anyInt64le :: forall (st :: ZeroBitType) e. ParserT st e Int64
anyInt64le = forall (st :: ZeroBitType) e. ParserT st e Int64
anyInt64
#endif
{-# inline anyInt64le #-}
anyInt64be :: ParserT st e Int64
#ifdef WORDS_BIGENDIAN
anyInt64be = anyInt64
#else
anyInt64be :: forall (st :: ZeroBitType) e. ParserT st e Int64
anyInt64be = forall (st :: ZeroBitType) e r.
(Word64 -> ParserT st e r) -> ParserT st e r
withAnyWord64 (forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Int64
word64ToInt64 forall b c a. (b -> c) -> (a -> b) -> a -> c
. Word64 -> Word64
byteSwap64)
#endif
{-# inline anyInt64be #-}
word8 :: Word8 -> ParserT st e ()
word8 :: forall (st :: ZeroBitType) e. Word8 -> ParserT st e ()
word8 Word8
wExpected = forall (st :: ZeroBitType) e a.
(ForeignPtrContents -> Addr# -> Addr# -> st -> Res# st e a)
-> ParserT st e a
ParserT \ForeignPtrContents
fp Addr#
eob Addr#
buf st
st -> case Addr# -> Addr# -> Int#
eqAddr# Addr#
eob Addr#
buf of
Int#
1# -> forall (st :: ZeroBitType) e a. st -> Res# st e a
Fail# st
st
Int#
_ -> let w# :: Word8#
w# = Addr# -> Int# -> Word8#
indexWord8OffAddr# Addr#
buf Int#
0#
in if Word8# -> Word8
W8# Word8#
w# forall a. Eq a => a -> a -> Bool
== Word8
wExpected
then forall (st :: ZeroBitType) a e. st -> a -> Addr# -> Res# st e a
OK# st
st () (Addr# -> Int# -> Addr#
plusAddr# Addr#
buf Int#
1#)
else forall (st :: ZeroBitType) e a. st -> Res# st e a
Fail# st
st
{-# inline word8 #-}
sizedUnsafe# :: Eq a => Int# -> (Addr# -> Int# -> a) -> a -> ParserT st e ()
sizedUnsafe# :: forall a (st :: ZeroBitType) e.
Eq a =>
Int# -> (Addr# -> Int# -> a) -> a -> ParserT st e ()
sizedUnsafe# Int#
size# Addr# -> Int# -> a
indexOffAddr a
aExpected =
forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySizedUnsafe# Int#
size# Addr# -> Int# -> a
indexOffAddr forall {f :: * -> *}. Alternative f => a -> f ()
go
where
go :: a -> f ()
go a
aParsed =
if a
aParsed forall a. Eq a => a -> a -> Bool
== a
aExpected
then forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
else forall (f :: * -> *) a. Alternative f => f a
empty
{-# inline sizedUnsafe# #-}
word8Unsafe :: Word8 -> ParserT st e ()
word8Unsafe :: forall (st :: ZeroBitType) e. Word8 -> ParserT st e ()
word8Unsafe = forall a (st :: ZeroBitType) e.
Eq a =>
Int# -> (Addr# -> Int# -> a) -> a -> ParserT st e ()
sizedUnsafe# Int#
1# (\Addr#
a Int#
i -> Word8# -> Word8
W8# (Addr# -> Int# -> Word8#
indexWord8OffAddr# Addr#
a Int#
i))
{-# inline word8Unsafe #-}
word16Unsafe :: Word16 -> ParserT st e ()
word16Unsafe :: forall (st :: ZeroBitType) e. Word16 -> ParserT st e ()
word16Unsafe = forall a (st :: ZeroBitType) e.
Eq a =>
Int# -> (Addr# -> Int# -> a) -> a -> ParserT st e ()
sizedUnsafe# Int#
2# (\Addr#
a Int#
i -> Word16# -> Word16
W16# (Addr# -> Int# -> Word16#
indexWord16OffAddr# Addr#
a Int#
i))
{-# inline word16Unsafe #-}
word32Unsafe :: Word32 -> ParserT st e ()
word32Unsafe :: forall (st :: ZeroBitType) e. Word32 -> ParserT st e ()
word32Unsafe = forall a (st :: ZeroBitType) e.
Eq a =>
Int# -> (Addr# -> Int# -> a) -> a -> ParserT st e ()
sizedUnsafe# Int#
4# (\Addr#
a Int#
i -> Word32# -> Word32
W32# (Addr# -> Int# -> Word32#
indexWord32OffAddr# Addr#
a Int#
i))
{-# inline word32Unsafe #-}
word64Unsafe :: Word64 -> ParserT st e ()
word64Unsafe :: forall (st :: ZeroBitType) e. Word64 -> ParserT st e ()
word64Unsafe = forall a (st :: ZeroBitType) e.
Eq a =>
Int# -> (Addr# -> Int# -> a) -> a -> ParserT st e ()
sizedUnsafe# Int#
8# (\Addr#
a Int#
i -> Word# -> Word64
W64# (Addr# -> Int# -> Word#
indexWord64OffAddr# Addr#
a Int#
i))
{-# inline word64Unsafe #-}
anyWord8Unsafe :: ParserT st e Word8
anyWord8Unsafe :: forall (st :: ZeroBitType) e. ParserT st e Word8
anyWord8Unsafe = forall a (st :: ZeroBitType) e r.
Int#
-> (Addr# -> Int# -> a) -> (a -> ParserT st e r) -> ParserT st e r
withAnySizedUnsafe# Int#
1# (\Addr#
a Int#
i -> Word8# -> Word8
W8# (Addr# -> Int# -> Word8#
indexWord8OffAddr# Addr#
a Int#
i)) forall (f :: * -> *) a. Applicative f => a -> f a
pure
{-# inline anyWord8Unsafe #-}