ptr 0.15.4 → 0.15.5
raw patch · 3 files changed
+32/−1 lines, 3 files
Files
- library/Ptr/Peek.hs +6/−0
- library/Ptr/Poking.hs +25/−0
- ptr.cabal +1/−1
library/Ptr/Peek.hs view
@@ -58,6 +58,12 @@ {-# SCC "bytes" #-} Peek amount (\ ptr -> A.peekBytes ptr amount) +{-# INLINE shortByteString #-}+shortByteString :: Int -> Peek ShortByteString+shortByteString !amount =+ {-# SCC "shortByteString" #-} + Peek amount (\ ptr -> A.peekShortByteString ptr amount)+ {-# INLINE pokeAndPeek #-} pokeAndPeek :: B.PokeAndPeek input output -> Peek output pokeAndPeek (B.PokeAndPeek size _ io) =
library/Ptr/Poking.hs view
@@ -79,3 +79,28 @@ pokeAndPeek :: D.PokeAndPeek input output -> input -> Poking pokeAndPeek (D.PokeAndPeek space poke _) input = Poking space (\ptr -> poke ptr input)++{-# INLINABLE asciiIntegral #-}+asciiIntegral :: Integral a => a -> Poking+asciiIntegral =+ \case+ 0 ->+ word8 48+ x ->+ bool ((<>) (word8 45)) id (x >= 0) $+ loop mempty $+ abs x+ where+ loop builder remainder =+ case remainder of+ 0 ->+ builder+ _ ->+ case quotRem remainder 10 of+ (quot, rem) ->+ loop (word8 (48 + fromIntegral rem) <> builder) quot++{-# INLINE asciiChar #-}+asciiChar :: Char -> Poking+asciiChar =+ word8 . fromIntegral . ord
ptr.cabal view
@@ -1,7 +1,7 @@ name: ptr version:- 0.15.4+ 0.15.5 category: Ptr, Data synopsis: