compact-word-vectors 0.2.0.1 → 0.2.0.2
raw patch · 3 files changed
+11/−11 lines, 3 filesdep ~primitivesetup-changedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: primitive
API changes (from Hackage documentation)
Files
- Setup.hs +0/−2
- compact-word-vectors.cabal +3/−3
- src/Data/Vector/Compact/Blob.hs +8/−6
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
compact-word-vectors.cabal view
@@ -1,5 +1,5 @@ Name: compact-word-vectors-Version: 0.2.0.1+Version: 0.2.0.2 Synopsis: Small vectors of small integers stored very compactly. Description: A data structure to store small vectors of small integers with minimal memory overhead. For example the (word) vector@@ -12,9 +12,9 @@ License: BSD3 License-file: LICENSE Author: Balazs Komuves-Copyright: (c) 2019 Balazs Komuves+Copyright: (c) 2019-2021 Balazs Komuves Maintainer: bkomuves (plus) hackage (at) gmail (dot) com-Homepage: http://moire.be/haskell/+Homepage: https://github.com/bkomuves/compact-word-vectors Stability: Experimental Category: Data Tested-With: GHC == 8.6.5
src/Data/Vector/Compact/Blob.hs view
@@ -404,7 +404,7 @@ Blob5 a b c d e -> pokeArray ptr [a,b,c,d,e] >> return 5 Blob6 a b c d e f -> pokeArray ptr [a,b,c,d,e,f] >> return 6 BlobN ba -> let !nbytes = sizeofByteArray ba- in copyByteArrayToPtr ba 0 ptr nbytes >> return (shiftR nbytes 3)+ in myCopyByteArrayToPtr ba 0 ptr nbytes >> return (shiftR nbytes 3) peekBlob :: Int -> Ptr Word64 -> IO Blob peekBlob !n !ptr =@@ -418,7 +418,7 @@ 6 -> peekArray 6 ptr >>= \[a,b,c,d,e,f] -> return (Blob6 a b c d e f) _ -> do mut <- newByteArray (shiftL n 3)- copyPtrToByteArray ptr mut 0 (shiftL n 3)+ myCopyPtrToByteArray ptr mut 0 (shiftL n 3) ba <- unsafeFreezeByteArray mut return (BlobN ba) @@ -678,10 +678,12 @@ -- copyByteArrayToAddr# :: ByteArray# -> Int# -> Addr# -> Int# -> State# s -> State# s -- copyAddrToByteArray# :: Addr# -> MutableByteArray# s -> Int# -> Int# -> State# s -> State# s -copyByteArrayToPtr :: ByteArray -> Int -> Ptr a -> Int -> IO ()-copyByteArrayToPtr (ByteArray ba#) (I# ofs) (Ptr p) (I# n) = primitive_ $ copyByteArrayToAddr# ba# ofs p n +-- | note: @n@ this is number of /bytes/. Since primitive 0.7.1.0, the same function is +-- implemented there, but with different argument order and /number of elements/ instead.+myCopyByteArrayToPtr :: ByteArray -> Int -> Ptr a -> Int -> IO ()+myCopyByteArrayToPtr (ByteArray ba#) (I# ofs) (Ptr p) (I# n) = primitive_ $ copyByteArrayToAddr# ba# ofs p n -copyPtrToByteArray :: Ptr a -> MutableByteArray (PrimState IO) -> Int -> Int -> IO ()-copyPtrToByteArray (Ptr p) (MutableByteArray mut#) (I# ofs) (I# n) = primitive_ $ copyAddrToByteArray# p mut# ofs n+myCopyPtrToByteArray :: Ptr a -> MutableByteArray (PrimState IO) -> Int -> Int -> IO ()+myCopyPtrToByteArray (Ptr p) (MutableByteArray mut#) (I# ofs) (I# n) = primitive_ $ copyAddrToByteArray# p mut# ofs n --------------------------------------------------------------------------------