Copyright | Copyright © 2019 Lars Kuhtz <lakuhtz@gmail.com> |
---|---|
License | BSD3 |
Maintainer | Lars Kuhtz <lakuhtz@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
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
- w :: forall (n :: Nat). KnownNat n => Int
- int :: Integral a => Num b => a -> b
- fit :: Real a => Real b => Integral c => a -> b -> c
- intFit :: Integral a => Integral b => a -> b -> a
- nextPowerOfTwo :: Real a => Integral b => a -> b
- intNextPowerOfTwo :: Int -> Int
- set :: PrimMonad m => MutableByteArray (PrimState m) -> Int -> Word64 -> m ()
- get :: PrimMonad m => MutableByteArray (PrimState m) -> Int -> m Word64
- sip :: Storable a => Int -> a -> Word64
- fnv1a :: Storable a => Int -> a -> Word64
- fnv1a_bytes :: ByteArrayAccess a => Int -> a -> Word64
- sip_bytes :: ByteArrayAccess a => Int -> a -> Word64
- sip2 :: Storable a => Int -> a -> Word64
Documentation
fit :: Real a => Real b => Integral c => a -> b -> c Source #
fit a b
computes how many b
s 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 b
s are needed to fit a
, i.e.
\(\left\lceil\frac{a}{b}\right\rceil\).
For instance,
fit 7 3 == 3
fit 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
.
:: PrimMonad m | |
=> MutableByteArray (PrimState m) | |
-> Int | index in terms of |
-> Word64 |
|
-> m () |
Write a Word64
value into a Word32
aligned MutableByteArray
:: PrimMonad m | |
=> MutableByteArray (PrimState m) | byte array |
-> Int | index in terms of |
-> m Word64 | Word64 value that contains the result bits |
Get a Word64
from a Word32
aligned MutableByteArray
.
Hash functions
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.
Computes a 64 bit Fnv1a hash for a value that has an Storable
instance.
The first argument is use as a salt.
:: 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.
:: 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.