| Copyright | (c) 2017 Henri Verroken |
|---|---|
| License | BSD3 |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Digest.XXHash.FFI.C
Description
This module provides FFI imports to the xxHash library, see https://xxhash.com/doc/v0.8.3/ for documentation.
Synopsis
- c_xxh3_64bits_withSeed :: Ptr a -> CSize -> CULLong -> IO CULLong
- c_xxh3_64bits_withSeed_safe :: Ptr a -> CSize -> CULLong -> IO CULLong
- c_xxh64 :: Ptr a -> CSize -> CULLong -> IO CULLong
- c_xxh64_safe :: Ptr a -> CSize -> CULLong -> IO CULLong
- c_xxh32 :: Ptr a -> CSize -> CUInt -> IO CUInt
- c_xxh32_safe :: Ptr a -> CSize -> CUInt -> IO CUInt
- type XXH32State = MutableByteArray# RealWorld
- allocaXXH32State :: (XXH32State -> IO a) -> IO a
- c_xxh32_copyState :: XXH32State -> XXH32State -> IO ()
- c_xxh32_reset :: XXH32State -> CUInt -> IO ()
- c_xxh32_update :: XXH32State -> Ptr a -> CSize -> IO ()
- c_xxh32_update_safe :: XXH32State -> Ptr a -> CSize -> IO ()
- c_xxh32_digest :: XXH32State -> IO CUInt
- type XXH64State = MutableByteArray# RealWorld
- allocaXXH64State :: (XXH64State -> IO a) -> IO a
- c_xxh64_copyState :: XXH64State -> XXH64State -> IO ()
- c_xxh64_reset :: XXH64State -> CULLong -> IO ()
- c_xxh64_update :: XXH64State -> Ptr a -> CSize -> IO ()
- c_xxh64_update_safe :: XXH64State -> Ptr a -> CSize -> IO ()
- c_xxh64_digest :: XXH64State -> IO CULLong
- type XXH3State = MutableByteArray# RealWorld
- allocaXXH3State :: (XXH3State -> IO a) -> IO a
- initXXH3State :: XXH3State -> IO ()
- c_xxh3_copyState :: XXH3State -> XXH3State -> IO ()
- c_xxh3_64bits_reset_withSeed :: XXH3State -> CULLong -> IO ()
- c_xxh3_64bits_update :: XXH3State -> Ptr a -> CSize -> IO ()
- c_xxh3_64bits_update_safe :: XXH3State -> Ptr a -> CSize -> IO ()
- c_xxh3_64bits_digest :: XXH3State -> IO CULLong
Direct calculation
c_xxh3_64bits_withSeed Source #
Arguments
| :: Ptr a |
|
| -> CSize | Buffer length |
| -> CULLong | Seed |
| -> IO CULLong | Resulting hash |
Since: 0.3
c_xxh3_64bits_withSeed_safe Source #
Arguments
| :: Ptr a |
|
| -> CSize | Buffer length |
| -> CULLong | Seed |
| -> IO CULLong | Resulting hash |
Same as c_xxh3_64bits_withSeed, but using safe modifier.
Prefer this function to hash large amounts of data in multithreaded environment.
Since: 0.3
Arguments
| :: Ptr a |
|
| -> CSize | Buffer length |
| -> CULLong | Seed |
| -> IO CULLong | Resulting hash |
Arguments
| :: Ptr a |
|
| -> CSize | Buffer length |
| -> CULLong | Seed |
| -> IO CULLong | Resulting hash |
Same as c_xxh64, but using safe modifier.
Prefer this function to hash large amounts of data in multithreaded environment.
Since: 0.3
Arguments
| :: Ptr a |
|
| -> CSize | Buffer length |
| -> CUInt | Seed |
| -> IO CUInt | Resulting hash |
Arguments
| :: Ptr a |
|
| -> CSize | Buffer length |
| -> CUInt | Seed |
| -> IO CUInt | Resulting hash |
Same as c_xxh32, but using safe modifier.
Prefer this function to hash large amounts of data in multithreaded environment.
Since: 0.3
32-bit state functions
type XXH32State = MutableByteArray# RealWorld Source #
Intermediate state for computing a XXH32 using segmentation or streams.
allocaXXH32State :: (XXH32State -> IO a) -> IO a Source #
allocaXXH32State f temporarily allocates a XXH32State and passes it
to the function f.
Arguments
| :: XXH32State | Destination |
| -> XXH32State | Source |
| -> IO () |
Arguments
| :: XXH32State | The state to reset |
| -> CUInt | The initial seed |
| -> IO () |
Arguments
| :: XXH32State | The state to update |
| -> Ptr a |
|
| -> CSize | Buffer length |
| -> IO () |
Arguments
| :: XXH32State | The state to update |
| -> Ptr a |
|
| -> CSize | Buffer length |
| -> IO () |
Same as c_xxh32_update, but using safe modifier.
Prefer this function to hash large amounts of data in multithreaded environment.
Since: 0.3
Arguments
| :: XXH32State | The state to digest |
| -> IO CUInt | Resulting hash |
64-bit state functions
type XXH64State = MutableByteArray# RealWorld Source #
Intermediate state for computing a XXH64 using segmentation or streams.
allocaXXH64State :: (XXH64State -> IO a) -> IO a Source #
allocaXXH64State f temporarily allocates a XXH64State and passes it
to the function f.
Arguments
| :: XXH64State | Destination |
| -> XXH64State | Source |
| -> IO () |
Arguments
| :: XXH64State | The state to reset |
| -> CULLong | The initial seed |
| -> IO () |
Arguments
| :: XXH64State | The state to update |
| -> Ptr a |
|
| -> CSize | Buffer length |
| -> IO () |
Arguments
| :: XXH64State | The state to update |
| -> Ptr a |
|
| -> CSize | Buffer length |
| -> IO () |
Same as c_xxh64_update, but using safe modifier.
Prefer this function to hash large amounts of data in multithreaded environment.
Since: 0.3
Arguments
| :: XXH64State | The state to digest |
| -> IO CULLong | Resulting hash |
XXH3 state functions
type XXH3State = MutableByteArray# RealWorld Source #
Intermediate state for computing a XXH3 using segmentation or streams.
Since: 0.3
allocaXXH3State :: (XXH3State -> IO a) -> IO a Source #
allocaXXH3State f temporarily allocates a XXH3State and passes it
to the function f.
64-bytes (yes, bytes not bits) alignment requirement is mandated by
xxhash!
initXXH3State :: XXH3State -> IO () Source #
initXXH3State initializes a XXH3State before its first reset
using c_xxh3_64bits_reset_withSeed, see comment of
XXH3_INITSTATE in xxhash.h for details. Here we don't actually
call into XXH3_INITSTATE in C and instead use the memset primop,
so we can avoid the register shuffling overhead of an unsafe ccall
and the NCG shall be capable of inlining the memset primop into a
few memory stores with the -fmax-inline-memset-insns=
optimization.
c_xxh3_64bits_reset_withSeed Source #
Arguments
| :: XXH3State | The state to reset |
| -> CULLong | The initial seed |
| -> IO () |
Since: 0.3
Arguments
| :: XXH3State | The state to update |
| -> Ptr a |
|
| -> CSize | Buffer length |
| -> IO () |
Since: 0.3
c_xxh3_64bits_update_safe Source #
Arguments
| :: XXH3State | The state to update |
| -> Ptr a |
|
| -> CSize | Buffer length |
| -> IO () |
Same as c_xxh3_64bits_update, but using safe modifier.
Prefer this function to hash large amounts of data in multithreaded environment.
Since: 0.3
Arguments
| :: XXH3State | The state to digest |
| -> IO CULLong | Resulting hash |
Since: 0.3