add a LE64 method
This commit is contained in:
parent
21c4c1befb
commit
7e6f570e49
@ -22,6 +22,7 @@ module Crypto.Internal.ByteArray
|
|||||||
, byteArrayToBS
|
, byteArrayToBS
|
||||||
, byteArrayFromBS
|
, byteArrayFromBS
|
||||||
, byteArrayToW64BE
|
, byteArrayToW64BE
|
||||||
|
, byteArrayToW64LE
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
@ -127,3 +128,6 @@ byteArrayFromBS bs = byteArrayCopyAndFreeze bs (\_ -> return ())
|
|||||||
|
|
||||||
byteArrayToW64BE :: ByteArrayAccess bs => bs -> Int -> Word64
|
byteArrayToW64BE :: ByteArrayAccess bs => bs -> Int -> Word64
|
||||||
byteArrayToW64BE bs ofs = unsafeDoIO $ withByteArray bs $ \p -> fromBE64 <$> peek (p `plusPtr` ofs)
|
byteArrayToW64BE bs ofs = unsafeDoIO $ withByteArray bs $ \p -> fromBE64 <$> peek (p `plusPtr` ofs)
|
||||||
|
|
||||||
|
byteArrayToW64LE :: ByteArrayAccess bs => bs -> Int -> Word64
|
||||||
|
byteArrayToW64LE bs ofs = unsafeDoIO $ withByteArray bs $ \p -> fromLE64 <$> peek (p `plusPtr` ofs)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user