memory-0.15.0: memory and related abstraction stuff
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Memory.PtrMethods

Description

methods to manipulate raw memory representation

Synopsis

Documentation

memCreateTemporary :: Int -> (Ptr Word8 -> IO a) -> IO a #

Create a new temporary buffer

memXor :: Ptr Word8 -> Ptr Word8 -> Ptr Word8 -> Int -> IO () #

xor bytes from source1 and source2 to destination

d = s1 xor s2

s1, nor s2 are modified unless d point to s1 or s2

memXorWith :: Ptr Word8 -> Word8 -> Ptr Word8 -> Int -> IO () #

xor bytes from source with a specific value to destination

d = replicate (sizeof s) v xor s

memCopy :: Ptr Word8 -> Ptr Word8 -> Int -> IO () #

Copy a set number of bytes from src to dst

memSet :: Ptr Word8 -> Word8 -> Int -> IO () #

Set n number of bytes to the same value v

memReverse :: Ptr Word8 -> Ptr Word8 -> Int -> IO () #

Reverse a set number of bytes from src to dst. Memory locations should not overlap.

memEqual :: Ptr Word8 -> Ptr Word8 -> Int -> IO Bool #

Check if two piece of memory are equals

memConstEqual :: Ptr Word8 -> Ptr Word8 -> Int -> IO Bool #

A constant time equality test for 2 Memory buffers

compared to normal equality function, this function will go over all the bytes present before yielding a result even when knowing the overall result early in the processing.

memCompare :: Ptr Word8 -> Ptr Word8 -> Int -> IO Ordering #

Compare two piece of memory and returns how they compare