module Crypto.Internal.Words
( Word128(..)
, w64to32
, w32to64
) where
import Data.Word
import Data.Bits
import Data.Memory.ExtendedWords
w64to32 :: Word64 -> (Word32, Word32)
w64to32 :: Word64 -> (Word32, Word32)
w64to32 Word64
w = (Word64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Word64
w Word64 -> Int -> Word64
forall a. Bits a => a -> Int -> a
`shiftR` Int
32), Word64 -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word64
w)
w32to64 :: (Word32, Word32) -> Word64
w32to64 :: (Word32, Word32) -> Word64
w32to64 (Word32
x1, Word32
x2) = ((Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
x1) Word64 -> Int -> Word64
forall a. Bits a => a -> Int -> a
`shiftL` Int
32) Word64 -> Word64 -> Word64
forall a. Bits a => a -> a -> a
.|. (Word32 -> Word64
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word32
x2)