-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Bindings and high-level helpers for xxHash family of extremely fast
--   non-cryptographic hash functions.
@package xxhash-ffi
@version 0.3.1


-- | This module provides FFI imports to the xxHash library, see
--   <a>https://xxhash.com/doc/v0.8.3/</a> for documentation.
module Data.Digest.XXHash.FFI.C

c_xxh3_64bits_withSeed :: Ptr a -> CSize -> CULLong -> IO CULLong

-- | Same as <a>c_xxh3_64bits_withSeed</a>, but using <tt>safe</tt>
--   modifier. Prefer this function to hash large amounts of data in
--   multithreaded environment.
c_xxh3_64bits_withSeed_safe :: Ptr a -> CSize -> CULLong -> IO CULLong
c_xxh64 :: Ptr a -> CSize -> CULLong -> IO CULLong

-- | Same as <a>c_xxh64</a>, but using <tt>safe</tt> modifier. Prefer this
--   function to hash large amounts of data in multithreaded environment.
c_xxh64_safe :: Ptr a -> CSize -> CULLong -> IO CULLong
c_xxh32 :: Ptr a -> CSize -> CUInt -> IO CUInt

-- | Same as <a>c_xxh32</a>, but using <tt>safe</tt> modifier. Prefer this
--   function to hash large amounts of data in multithreaded environment.
c_xxh32_safe :: Ptr a -> CSize -> CUInt -> IO CUInt

-- | Intermediate state for computing a XXH32 using segmentation or
--   streams.
type XXH32State = MutableByteArray# RealWorld

-- | <a>allocaXXH32State</a> <tt>f</tt> temporarily allocates a
--   <a>XXH32State</a> and passes it to the function <tt>f</tt>.
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 ()

-- | Same as <a>c_xxh32_update</a>, but using <tt>safe</tt> modifier.
--   Prefer this function to hash large amounts of data in multithreaded
--   environment.
c_xxh32_update_safe :: XXH32State -> Ptr a -> CSize -> IO ()
c_xxh32_digest :: XXH32State -> IO CUInt

-- | Intermediate state for computing a XXH64 using segmentation or
--   streams.
type XXH64State = MutableByteArray# RealWorld

-- | <a>allocaXXH64State</a> <tt>f</tt> temporarily allocates a
--   <a>XXH64State</a> and passes it to the function <tt>f</tt>.
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 ()

-- | Same as <a>c_xxh64_update</a>, but using <tt>safe</tt> modifier.
--   Prefer this function to hash large amounts of data in multithreaded
--   environment.
c_xxh64_update_safe :: XXH64State -> Ptr a -> CSize -> IO ()
c_xxh64_digest :: XXH64State -> IO CULLong

-- | Intermediate state for computing a XXH3 using segmentation or streams.
type XXH3State = MutableByteArray# RealWorld

-- | <a>allocaXXH3State</a> <tt>f</tt> temporarily allocates a
--   <a>XXH3State</a> and passes it to the function <tt>f</tt>. 64-bytes
--   (yes, bytes not bits) alignment requirement is mandated by xxhash!
allocaXXH3State :: (XXH3State -> IO a) -> IO a

-- | <a>initXXH3State</a> initializes a <a>XXH3State</a> before its first
--   reset using <a>c_xxh3_64bits_reset_withSeed</a>, see comment of
--   <tt>XXH3_INITSTATE</tt> in <tt>xxhash.h</tt> for details. Here we
--   don't actually call into <tt>XXH3_INITSTATE</tt> 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
--   <tt>-fmax-inline-memset-insns=</tt> optimization.
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 ()

-- | Same as <a>c_xxh3_64bits_update</a>, but using <tt>safe</tt> modifier.
--   Prefer this function to hash large amounts of data in multithreaded
--   environment.
c_xxh3_64bits_update_safe :: XXH3State -> Ptr a -> CSize -> IO ()

c_xxh3_64bits_digest :: XXH3State -> IO CULLong


-- | This module provides high-level helpers for the xxHash library, see
--   <a>https://xxhash.com</a>.
module Data.Digest.XXHash.FFI

-- | A newtype over <a>ByteString</a> and <a>Text</a> to provide convenient
--   access to the <a>XXH3</a> hash function via <a>Hashable</a> type
--   class.
newtype XXH3 a
XXH3 :: a -> XXH3 a
[unXXH3] :: XXH3 a -> a

-- | Class for hashable data types.

-- | <i>Deprecated: Use new, XXH3-based functions instead</i>
class XXHash t

-- | Calculate the 32-bit xxHash using a given seed.
xxh32 :: XXHash t => t -> Word32 -> Word32

-- | Calculate the 64-bit xxHash using a given seed.
xxh64 :: XXHash t => t -> Word64 -> Word64
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Digest.XXHash.FFI.XXH3 a)
instance Data.Hashable.Class.Hashable (Data.Digest.XXHash.FFI.XXH3 Data.ByteString.Internal.Type.ByteString)
instance Data.Hashable.Class.Hashable (Data.Digest.XXHash.FFI.XXH3 Data.ByteString.Lazy.Internal.ByteString)
instance Data.Hashable.Class.Hashable (Data.Digest.XXHash.FFI.XXH3 Data.Array.Byte.ByteArray)
instance Data.Hashable.Class.Hashable (Data.Digest.XXHash.FFI.XXH3 Data.Text.Internal.Text)
instance Data.Hashable.Class.Hashable (Data.Digest.XXHash.FFI.XXH3 Data.Text.Internal.Lazy.Text)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Digest.XXHash.FFI.XXH3 a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Data.Digest.XXHash.FFI.XXH3 a)
instance Data.Digest.XXHash.FFI.XXHash Data.ByteString.Lazy.Internal.ByteString
instance Data.Digest.XXHash.FFI.XXHash Data.ByteString.Internal.Type.ByteString
