memory-0.18.0: memory and related abstraction stuff
License BSD-style
Maintainer Vincent Hanquez <vincent@snarc.org>
Stability experimental
Portability unknown
Safe Haskell Safe-Inferred
Language Haskell2010

Data.Memory.PtrMethods

Description

methods to manipulate raw memory representation

Synopsis

Documentation

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

Create a new temporary buffer

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

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 () Source #

xor bytes from source with a specific value to destination

d = replicate (sizeof s) v xor s

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

Copy a set number of bytes from src to dst

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

Set n number of bytes to the same value v

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

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

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

Check if two piece of memory are equals

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

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 Source #

Compare two piece of memory and returns how they compare