bytehash 0.1.0.0 → 0.1.1.0
raw patch · 3 files changed
+20/−13 lines, 3 filesdep −primitive-checkeddep ~basedep ~primitivedep ~primitive-unlifted
Dependencies removed: primitive-checked
Dependency ranges changed: base, primitive, primitive-unlifted
Files
- bytehash.cabal +7/−7
- src/Data/Bytes/HashMap.hs +9/−3
- src/Data/Bytes/HashMap/Word.hs +4/−3
bytehash.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: bytehash-version: 0.1.0.0+version: 0.1.1.0 synopsis: Universal hashing of bytes description: Taken together, universal hash functions and a good source of entropy@@ -28,14 +28,14 @@ other-modules: Data.Bytes.HashMap.Internal build-depends:- , base >=4.12 && <5+ , base >=4.17.1 && <5 , byte-order >=0.1.2 && <0.2- , primitive >=0.7 && <0.8- , primitive-unlifted >=0.1.2 && <0.2+ , primitive >=0.7 && <0.10+ , primitive-unlifted >=2.1 , byteslice >=0.2.1 && <0.3 , entropy >=0.4.1.5 && <0.5- , bytestring >=0.10.8 && <0.11- , transformers >=0.5.6 && <0.6+ , bytestring >=0.10.8 && <0.12+ , transformers >=0.5.6 && <0.7 hs-source-dirs: src ghc-options: -O2 -Wall default-language: Haskell2010@@ -50,7 +50,7 @@ , bytehash , byteslice >=0.1.4 , entropy >=0.4.1.5- , primitive-checked >=0.6.4+ , primitive >=0.6.4 , tasty >=1.0 , tasty-hunit >=0.9 , tasty-hedgehog
src/Data/Bytes/HashMap.hs view
@@ -17,6 +17,7 @@ -- | Implementation of static hash map data structure. module Data.Bytes.HashMap ( Map+ , empty , lookup , fromList , fromTrustedList@@ -63,10 +64,11 @@ import Data.Ord (Down(Down)) import Data.Primitive (ByteArray(..),PrimArray(..)) import Data.Primitive.SmallArray (SmallArray(..))-import Data.Primitive.Unlifted.Array (UnliftedArray(..))+import Data.Primitive.Unlifted.Array (UnliftedArray,UnliftedArray_(UnliftedArray))+import Data.Primitive.Unlifted.Array.Primops (UnliftedArray#) import Data.STRef (STRef,newSTRef,writeSTRef,readSTRef) import Foreign.Ptr (plusPtr)-import GHC.Exts (Ptr(Ptr),Int(I#),SmallArray#,ByteArray#,ArrayArray#,Int#)+import GHC.Exts (Ptr(Ptr),Int(I#),SmallArray#,ByteArray#,Int#) import GHC.Exts (RealWorld) import GHC.IO (ioToST) import GHC.Word (Word(W#),Word32,Word8)@@ -97,6 +99,10 @@ ref <- newSTRef 0 fromListWithGen ref askForEntropyST const xs +-- | An empty @Map@.+empty :: Map v+empty = Map mempty mempty mempty mempty mempty+ -- | Returns the value associated with the key in the map. lookup :: Bytes -> Map v -> Maybe v {-# inline lookup #-}@@ -117,7 +123,7 @@ -- for a suitable offset. lookup# :: (# ByteArray#, Int#, Int# #)- -> (# ByteArray#, ArrayArray#, ByteArray#, ArrayArray#, SmallArray# v #)+ -> (# ByteArray#, UnliftedArray# ByteArray#, ByteArray#, UnliftedArray# ByteArray#, SmallArray# v #) -> (# (# #) | v #) {-# noinline lookup# #-} lookup# (# keyArr#, keyOff#, keyLen# #) (# entropyA#, entropies#, offsets#, keys#, vals# #)
src/Data/Bytes/HashMap/Word.hs view
@@ -25,9 +25,10 @@ import Data.Bytes.Types (Bytes(Bytes)) import Data.Int (Int32) import Data.Primitive (ByteArray,ByteArray(..),PrimArray(..))-import GHC.Exts (Int(I#),ByteArray#,ArrayArray#,Int#,Word#)+import GHC.Exts (Int(I#),ByteArray#,Int#,Word#) import GHC.Word (Word(W#),Word32)-import Data.Primitive.Unlifted.Array (UnliftedArray(..))+import Data.Primitive.Unlifted.Array (UnliftedArray,UnliftedArray_(UnliftedArray))+import Data.Primitive.Unlifted.Array.Primops (UnliftedArray#) import System.Entropy (CryptHandle) import qualified Data.Bytes as Bytes@@ -82,7 +83,7 @@ lookup# :: (# ByteArray#, Int#, Int# #)- -> (# ByteArray#, ArrayArray#, ByteArray#, ArrayArray#, ByteArray# #)+ -> (# ByteArray#, UnliftedArray# ByteArray#, ByteArray#, UnliftedArray# ByteArray#, ByteArray# #) -> (# (# #) | Word# #) {-# noinline lookup# #-} lookup# (# keyArr#, keyOff#, keyLen# #) (# entropyA#, entropies#, offsets#, keys#, vals# #)