large-hashable 0.1.0.3 → 0.1.0.4
raw patch · 9 files changed
+72/−101 lines, 9 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.LargeHashable.Intern: HashUpdates :: {-# NOUNPACK #-} !(Ptr Word8 -> Int -> IO ()) -> {-# NOUNPACK #-} !(CChar -> IO ()) -> {-# NOUNPACK #-} !(CUChar -> IO ()) -> {-# NOUNPACK #-} !(CShort -> IO ()) -> {-# NOUNPACK #-} !(CUShort -> IO ()) -> {-# NOUNPACK #-} !(CInt -> IO ()) -> {-# NOUNPACK #-} !(CUInt -> IO ()) -> {-# NOUNPACK #-} !(CLong -> IO ()) -> {-# NOUNPACK #-} !(CULong -> IO ()) -> HashUpdates
+ Data.LargeHashable.Intern: HashUpdates :: {-# NOUNPACK #-} !(Ptr Word8 -> Int -> IO ()) -> {-# NOUNPACK #-} !(Int8 -> IO ()) -> {-# NOUNPACK #-} !(Word8 -> IO ()) -> {-# NOUNPACK #-} !(Int16 -> IO ()) -> {-# NOUNPACK #-} !(Word16 -> IO ()) -> {-# NOUNPACK #-} !(Int32 -> IO ()) -> {-# NOUNPACK #-} !(Word32 -> IO ()) -> {-# NOUNPACK #-} !(Int64 -> IO ()) -> {-# NOUNPACK #-} !(Word64 -> IO ()) -> HashUpdates
- Data.LargeHashable.Intern: [hu_updateChar] :: HashUpdates -> {-# NOUNPACK #-} !(CChar -> IO ())
+ Data.LargeHashable.Intern: [hu_updateChar] :: HashUpdates -> {-# NOUNPACK #-} !(Int8 -> IO ())
- Data.LargeHashable.Intern: [hu_updateInt] :: HashUpdates -> {-# NOUNPACK #-} !(CInt -> IO ())
+ Data.LargeHashable.Intern: [hu_updateInt] :: HashUpdates -> {-# NOUNPACK #-} !(Int32 -> IO ())
- Data.LargeHashable.Intern: [hu_updateLong] :: HashUpdates -> {-# NOUNPACK #-} !(CLong -> IO ())
+ Data.LargeHashable.Intern: [hu_updateLong] :: HashUpdates -> {-# NOUNPACK #-} !(Int64 -> IO ())
- Data.LargeHashable.Intern: [hu_updateShort] :: HashUpdates -> {-# NOUNPACK #-} !(CShort -> IO ())
+ Data.LargeHashable.Intern: [hu_updateShort] :: HashUpdates -> {-# NOUNPACK #-} !(Int16 -> IO ())
- Data.LargeHashable.Intern: [hu_updateUChar] :: HashUpdates -> {-# NOUNPACK #-} !(CUChar -> IO ())
+ Data.LargeHashable.Intern: [hu_updateUChar] :: HashUpdates -> {-# NOUNPACK #-} !(Word8 -> IO ())
- Data.LargeHashable.Intern: [hu_updateUInt] :: HashUpdates -> {-# NOUNPACK #-} !(CUInt -> IO ())
+ Data.LargeHashable.Intern: [hu_updateUInt] :: HashUpdates -> {-# NOUNPACK #-} !(Word32 -> IO ())
- Data.LargeHashable.Intern: [hu_updateULong] :: HashUpdates -> {-# NOUNPACK #-} !(CULong -> IO ())
+ Data.LargeHashable.Intern: [hu_updateULong] :: HashUpdates -> {-# NOUNPACK #-} !(Word64 -> IO ())
- Data.LargeHashable.Intern: [hu_updateUShort] :: HashUpdates -> {-# NOUNPACK #-} !(CUShort -> IO ())
+ Data.LargeHashable.Intern: [hu_updateUShort] :: HashUpdates -> {-# NOUNPACK #-} !(Word16 -> IO ())
Files
- ChangeLog +11/−0
- cbits/md5.c +9/−9
- cbits/md5.h +8/−8
- default.nix +2/−0
- large-hashable.cabal +4/−3
- shell.nix +0/−43
- src/Data/LargeHashable/Class.hs +19/−19
- src/Data/LargeHashable/Intern.hs +9/−9
- src/Data/LargeHashable/MD5.hs +10/−10
+ ChangeLog view
@@ -0,0 +1,11 @@+0.1.0.4: 2017-03-19+ * fixed build on `i686` related to non-fixed size integers++0.1.0.2: 2016-10-10+ * fixed build problems because of TemplateHaskell 2.11++0.1.0.1: 2016-08-10+ * fixed build issue: added bitfn.h to cabal file++0.1.0.0: 2016-08-09+ * initial release
cbits/md5.c view
@@ -152,42 +152,42 @@ memcpy(ctx->buf + index, data, len); } -void md5_update_char(struct md5_ctx *ctx, char data)+void md5_update_char(struct md5_ctx *ctx, int8_t data) { md5_update(ctx, (uint8_t *)&data, sizeof(data)); } -void md5_update_uchar(struct md5_ctx *ctx, unsigned char data)+void md5_update_uchar(struct md5_ctx *ctx, uint8_t data) {- md5_update(ctx, (uint8_t *)&data, sizeof(data));+ md5_update(ctx, &data, sizeof(data)); } -void md5_update_short(struct md5_ctx *ctx, short data)+void md5_update_short(struct md5_ctx *ctx, int16_t data) { md5_update(ctx, (uint8_t *)&data, sizeof(data)); } -void md5_update_ushort(struct md5_ctx *ctx, unsigned short data)+void md5_update_ushort(struct md5_ctx *ctx, uint16_t data) { md5_update(ctx, (uint8_t *)&data, sizeof(data)); } -void md5_update_int(struct md5_ctx *ctx, int data)+void md5_update_int(struct md5_ctx *ctx, int32_t data) { md5_update(ctx, (uint8_t *)&data, sizeof(data)); } -void md5_update_uint(struct md5_ctx *ctx, unsigned int data)+void md5_update_uint(struct md5_ctx *ctx, uint32_t data) { md5_update(ctx, (uint8_t *)&data, sizeof(data)); } -void md5_update_long(struct md5_ctx *ctx, long data)+void md5_update_long(struct md5_ctx *ctx, int64_t data) { md5_update(ctx, (uint8_t *)&data, sizeof(data)); } -void md5_update_ulong(struct md5_ctx *ctx, unsigned long data)+void md5_update_ulong(struct md5_ctx *ctx, uint64_t data) { md5_update(ctx, (uint8_t *)&data, sizeof(data)); }
cbits/md5.h view
@@ -38,14 +38,14 @@ void md5_init(struct md5_ctx *ctx); void md5_update(struct md5_ctx *ctx, uint8_t *data, uint32_t len);-void md5_update_char(struct md5_ctx *ctx, char data);-void md5_update_uchar(struct md5_ctx *ctx, unsigned char data);-void md5_update_short(struct md5_ctx *ctx, short data);-void md5_update_ushort(struct md5_ctx *ctx, unsigned short data);-void md5_update_int(struct md5_ctx *ctx, int data);-void md5_update_uint(struct md5_ctx *ctx, unsigned int data);-void md5_update_long(struct md5_ctx *ctx, long data);-void md5_update_ulong(struct md5_ctx *ctx, unsigned long data);+void md5_update_char(struct md5_ctx *ctx, int8_t data);+void md5_update_uchar(struct md5_ctx *ctx, uint8_t data);+void md5_update_short(struct md5_ctx *ctx, int16_t data);+void md5_update_ushort(struct md5_ctx *ctx, uint16_t data);+void md5_update_int(struct md5_ctx *ctx, int32_t data);+void md5_update_uint(struct md5_ctx *ctx, uint32_t data);+void md5_update_long(struct md5_ctx *ctx, int64_t data);+void md5_update_ulong(struct md5_ctx *ctx, uint64_t data); void md5_finalize(struct md5_ctx *ctx, uint8_t *out); #endif
+ default.nix view
@@ -0,0 +1,2 @@+let pkgs = import <nixpkgs> { };+in pkgs.haskellPackages.callPackage ./large-hashable.nix { }
large-hashable.cabal view
@@ -1,5 +1,5 @@ name: large-hashable-version: 0.1.0.3+version: 0.1.0.4 synopsis: Efficiently hash (large) Haskell values description: Please see README.md homepage: https://github.com/factisresearch/large-hashable@@ -7,7 +7,7 @@ license-file: LICENSE author: Stefan Wehr, Lukas Epple maintainer: Stefan Wehr <wehr@cp-med.com>-copyright: 2015 - 2016 factis research GmbH+copyright: 2015 - 2017 factis research GmbH category: Web build-type: Simple cabal-version: >=1.10@@ -15,7 +15,8 @@ cbits/md5.h cbits/bitfn.h README.md- shell.nix+ ChangeLog+ default.nix stack.yaml library
− shell.nix
@@ -1,43 +0,0 @@-{ nixpkgs ? import <nixpkgs> {}, compiler ? "default" }:--let-- inherit (nixpkgs) pkgs;-- f = { mkDerivation, base, base16-bytestring, byteable, bytes- , bytestring, cereal, containers, cryptohash, deepseq, hashable- , HTF, QuickCheck, safecopy, stdenv, template-haskell, text, time- , transformers, unordered-containers- }:- mkDerivation {- pname = "large-hashable";- version = "0.1.0.0";- src = ./.;- isLibrary = true;- isExecutable = true;- libraryHaskellDepends = [- base base16-bytestring bytes bytestring containers template-haskell- text time transformers unordered-containers- ];- executableHaskellDepends = [- base byteable bytes bytestring cereal cryptohash deepseq safecopy- text transformers- ];- testHaskellDepends = [- base bytes bytestring containers hashable HTF QuickCheck text- unordered-containers- ];- homepage = "http://github.com/githubuser/large-hashable#readme";- description = "Initial project template from stack";- license = stdenv.lib.licenses.bsd3;- };-- haskellPackages = if compiler == "default"- then pkgs.haskellPackages- else pkgs.haskell.packages.${compiler};-- drv = haskellPackages.callPackage f {};--in-- if pkgs.lib.inNixShell then drv.env else drv
src/Data/LargeHashable/Class.hs view
@@ -162,61 +162,61 @@ ioInLH $ f updates x instance LargeHashable Int where- updateHash i = updateHashWithFun hu_updateLong (fromIntegral i)+ updateHash = updateHashWithFun hu_updateLong . fromIntegral instance LargeHashable Int8 where- updateHash = updateHashWithFun hu_updateChar . CChar+ updateHash = updateHashWithFun hu_updateChar instance LargeHashable Int16 where- updateHash = updateHashWithFun hu_updateShort . CShort+ updateHash = updateHashWithFun hu_updateShort instance LargeHashable Int32 where- updateHash = updateHashWithFun hu_updateInt . CInt+ updateHash = updateHashWithFun hu_updateInt instance LargeHashable Int64 where- updateHash = updateHashWithFun hu_updateLong . CLong+ updateHash = updateHashWithFun hu_updateLong instance LargeHashable Word where- updateHash i = updateHashWithFun hu_updateLong (fromIntegral i)+ updateHash = updateHashWithFun hu_updateLong . fromIntegral instance LargeHashable Word8 where- updateHash = updateHashWithFun hu_updateUChar . CUChar+ updateHash = updateHashWithFun hu_updateUChar instance LargeHashable Word16 where- updateHash = updateHashWithFun hu_updateUShort . CUShort+ updateHash = updateHashWithFun hu_updateUShort instance LargeHashable Word32 where- updateHash = updateHashWithFun hu_updateUInt . CUInt+ updateHash = updateHashWithFun hu_updateUInt instance LargeHashable Word64 where- updateHash = updateHashWithFun hu_updateULong . CULong+ updateHash = updateHashWithFun hu_updateULong . fromIntegral instance LargeHashable CChar where- updateHash = updateHashWithFun hu_updateChar+ updateHash (CChar i) = updateHashWithFun hu_updateChar i instance LargeHashable CShort where- updateHash = updateHashWithFun hu_updateShort+ updateHash (CShort i) = updateHashWithFun hu_updateShort i instance LargeHashable CInt where- updateHash = updateHashWithFun hu_updateInt+ updateHash (CInt i) = updateHashWithFun hu_updateInt i instance LargeHashable CLong where- updateHash = updateHashWithFun hu_updateLong+ updateHash (CLong i) = updateHashWithFun hu_updateLong (fromIntegral i) instance LargeHashable CUChar where- updateHash = updateHashWithFun hu_updateUChar+ updateHash (CUChar w) = updateHashWithFun hu_updateUChar w instance LargeHashable CUShort where- updateHash = updateHashWithFun hu_updateUShort+ updateHash (CUShort w) = updateHashWithFun hu_updateUShort w instance LargeHashable CUInt where- updateHash = updateHashWithFun hu_updateUInt+ updateHash (CUInt w) = updateHashWithFun hu_updateUInt w instance LargeHashable CULong where- updateHash = updateHashWithFun hu_updateULong+ updateHash (CULong w) = updateHashWithFun hu_updateULong (fromIntegral w) instance LargeHashable Char where- updateHash = updateHashWithFun hu_updateUInt . CUInt . Utf8.c2w+ updateHash = updateHashWithFun hu_updateUInt . Utf8.c2w {-# INLINE updateHashInteger #-} updateHashInteger :: Integer -> LH ()
src/Data/LargeHashable/Intern.hs view
@@ -18,8 +18,8 @@ -- keep imports in alphabetic order (in Emacs, use "M-x sort-lines") import Control.Monad+import Data.Int import Data.Word-import Foreign.C.Types import Foreign.Ptr import System.IO.Unsafe (unsafePerformIO) @@ -28,14 +28,14 @@ data HashUpdates = HashUpdates { hu_updatePtr :: {-# NOUNPACK #-} !(Ptr Word8 -> Int -> IO ()) -- ^ adds a byte array to the hash- , hu_updateChar :: {-# NOUNPACK #-} !(CChar -> IO ()) -- Int8- , hu_updateUChar :: {-# NOUNPACK #-} !(CUChar -> IO ()) -- Word8- , hu_updateShort :: {-# NOUNPACK #-} !(CShort -> IO ()) -- Int16- , hu_updateUShort :: {-# NOUNPACK #-} !(CUShort -> IO ()) -- Word16- , hu_updateInt :: {-# NOUNPACK #-} !(CInt -> IO ()) -- Int32- , hu_updateUInt :: {-# NOUNPACK #-} !(CUInt -> IO ()) -- Word32- , hu_updateLong :: {-# NOUNPACK #-} !(CLong -> IO ()) -- Int64- , hu_updateULong :: {-# NOUNPACK #-} !(CULong -> IO ()) -- Word64+ , hu_updateChar :: {-# NOUNPACK #-} !(Int8 -> IO ()) -- Int8+ , hu_updateUChar :: {-# NOUNPACK #-} !(Word8 -> IO ()) -- Word8+ , hu_updateShort :: {-# NOUNPACK #-} !(Int16 -> IO ()) -- Int16+ , hu_updateUShort :: {-# NOUNPACK #-} !(Word16 -> IO ()) -- Word16+ , hu_updateInt :: {-# NOUNPACK #-} !(Int32 -> IO ()) -- Int32+ , hu_updateUInt :: {-# NOUNPACK #-} !(Word32 -> IO ()) -- Word32+ , hu_updateLong :: {-# NOUNPACK #-} !(Int64 -> IO ()) -- Int64+ , hu_updateULong :: {-# NOUNPACK #-} !(Word64 -> IO ()) -- Word64 } -- | The interface for a hashing algorithm. The interface contains a simple run
src/Data/LargeHashable/MD5.hs view
@@ -8,10 +8,10 @@ ) where -- keep imports in alphabetic order (in Emacs, use "M-x sort-lines")+import Data.Int import Data.LargeHashable.Intern import Data.LargeHashable.LargeWord import Data.Word-import Foreign.C.Types import Foreign.Marshal.Alloc import Foreign.Ptr import Foreign.Storable@@ -32,28 +32,28 @@ c_md5_update :: Ptr RawCtx -> Ptr Word8 -> Int -> IO () foreign import ccall unsafe "md5.h md5_update_char"- c_md5_update_char :: Ptr RawCtx -> CChar -> IO ()+ c_md5_update_char :: Ptr RawCtx -> Int8 -> IO () foreign import ccall unsafe "md5.h md5_update_uchar"- c_md5_update_uchar :: Ptr RawCtx -> CUChar -> IO ()+ c_md5_update_uchar :: Ptr RawCtx -> Word8 -> IO () foreign import ccall unsafe "md5.h md5_update_short"- c_md5_update_short :: Ptr RawCtx -> CShort -> IO ()+ c_md5_update_short :: Ptr RawCtx -> Int16 -> IO () foreign import ccall unsafe "md5.h md5_update_ushort"- c_md5_update_ushort :: Ptr RawCtx -> CUShort -> IO ()+ c_md5_update_ushort :: Ptr RawCtx -> Word16 -> IO () foreign import ccall unsafe "md5.h md5_update_int"- c_md5_update_int :: Ptr RawCtx -> CInt -> IO ()+ c_md5_update_int :: Ptr RawCtx -> Int32 -> IO () foreign import ccall unsafe "md5.h md5_update_uint"- c_md5_update_uint :: Ptr RawCtx -> CUInt -> IO ()+ c_md5_update_uint :: Ptr RawCtx -> Word32 -> IO () foreign import ccall unsafe "md5.h md5_update_long"- c_md5_update_long :: Ptr RawCtx -> CLong -> IO ()+ c_md5_update_long :: Ptr RawCtx -> Int64 -> IO () foreign import ccall unsafe "md5.h md5_update_ulong"- c_md5_update_ulong :: Ptr RawCtx -> CULong -> IO ()+ c_md5_update_ulong :: Ptr RawCtx -> Word64 -> IO () foreign import ccall unsafe "md5.h md5_finalize" c_md5_finalize :: Ptr RawCtx -> Ptr Word8 -> IO ()@@ -93,7 +93,7 @@ where xorMD5 (MD5Hash h1) (MD5Hash h2) = MD5Hash (h1 `xorW128` h2) updateHash updates (MD5Hash h) =- let f = hu_updateULong updates . CULong+ let f = hu_updateULong updates in do f (w128_first h) f (w128_second h) run f =