byte-order-0.1.3.0: Portable big-endian and little-endian conversions
Safe HaskellNone
LanguageHaskell2010

Data.Primitive.Ptr.BigEndian

Contents

Description

This is drop-in replacement for the read, write, and index functions present in Data.Primitive.Ptr. While the functions from those modules use native byte order, the functions in this one use big-endian byte order (most significant byte first).

Synopsis

Aligned

writeOffPtr :: (PrimMonad m, Prim a, Bytes a) => Ptr a -> Int -> a -> m () Source #

Write a primitive value to the pointer. The offset is given in elements of type a rather than in bytes. The most significant byte in the value comes first.

readOffPtr :: (PrimMonad m, Prim a, Bytes a) => Ptr a -> Int -> m a Source #

Read a primitive value from the pointer, interpreting the first byte as the most significant one. The offset is given in elements of type a rather than in bytes.

indexOffPtr :: (Prim a, Bytes a) => Ptr a -> Int -> a Source #

Read a primitive value from the pointer, interpreting the first byte as the most significant one. The offset is given in elements of type a rather than in bytes.