cuckoo-0.2.1: Haskell Implementation of Cuckoo Filters

CopyrightCopyright © 2019 Lars Kuhtz <lakuhtz@gmail.com>
LicenseBSD3
MaintainerLars Kuhtz <lakuhtz@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Data.Cuckoo.Internal

Contents

Description

Internal Utilities. No guarantee is made about the stability of these functions. Changes to these function won't be announced in the CHANGELOG and are not reflected in the package version.

Synopsis

Documentation

w :: forall (n :: Nat). KnownNat n => Int Source #

Reify type level Nat into Int value.

int :: Integral a => Num b => a -> b Source #

An shorter alias for fromIntegral.

fit :: Real a => Real b => Integral c => a -> b -> c Source #

fit a b computes how many bs are needed to fit a, i.e. \(\left\lceil\frac{a}{b}\right\rceil\).

For instance,

>>> fit 7 3
3
>>> fit 6 3
2

intFit :: Integral a => Integral b => a -> b -> a Source #

fit a b computes how many bs are needed to fit a, i.e. \(\left\lceil\frac{a}{b}\right\rceil\).

For instance,

>>> intFit 7 3
3
>>> intFit 6 3
2

nextPowerOfTwo :: Real a => Integral b => a -> b Source #

nextPowerOfTwo a computes the smallest power of two that is larger or equal than a.

intNextPowerOfTwo :: Int -> Int Source #

nextPowerOfTwo a computes the smallest power of two that is larger or equal than a.

set Source #

Arguments

:: PrimMonad m 
=> MutableByteArray (PrimState m) 
-> Int

index in terms of Word32

-> Word64

Word64 value that is written

-> m () 

Write a Word64 value into a Word32 aligned MutableByteArray

get Source #

Arguments

:: PrimMonad m 
=> MutableByteArray (PrimState m)

byte array

-> Int

index in terms of Word32

-> m Word64

Word64 value that contains the result bits

Get a Word64 from a Word32 aligned MutableByteArray.

Hash functions

sip Source #

Arguments

:: Storable a 
=> Int

Salt

-> a

Value that is hashes

-> Word64 

Computes a Sip hash for a value that has an Storable instance.

The first argument is a salt value that is used to derive the key for the hash computation.

fnv1a Source #

Arguments

:: Storable a 
=> Int

Salt

-> a

Value that is hashes

-> Word64 

Computes a 64 bit Fnv1a hash for a value that has an Storable instance.

The first argument is use as a salt.

fnv1a_bytes Source #

Arguments

:: ByteArrayAccess a 
=> Int

Salt

-> a

Value that is hashes

-> Word64 

Computes a 64 bit Fnv1a hash for a value that is an instance of ByteArrayAccess.

The first argument is use as a salt.

sip_bytes Source #

Arguments

:: ByteArrayAccess a 
=> Int

Salt

-> a

Value that is hashes

-> Word64 

Computes a Sip hash for a value that is an instance of ByteArrayAccess.

The first argument is a salt value that is used to derive the key for the hash computation.

sip2 :: Storable a => Int -> a -> Word64 Source #

An version of a Sip hash that is used internally. In order to avoid dependencies between different hash computations, it shouldn't be used in the implementation of instances of CuckooFilterHash.