    {-# LANGUAGE Safe #-}

    {-# OPTIONS_HADDOCK hide #-}
    {-# OPTIONS_GHC -fno-warn-missing-methods #-}
    {-# OPTIONS_GHC -fno-warn-name-shadowing #-}

    -- | Obsolete legacy module
    module Data.Hash.MD5.Zord64_HARD (Zord64) where

    import safe Data.Bits ( Bits(complement, (.&.), (.|.), shift) )
    import safe Data.Word ( Word32 )

    data Zord64 = W64 {Zord64 -> Word32
    lo,Zord64 -> Word32
    hi::Word32} deriving (Zord64 -> Zord64 -> Bool
    (Zord64 -> Zord64 -> Bool)
    -> (Zord64 -> Zord64 -> Bool) -> Eq Zord64
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Zord64 -> Zord64 -> Bool
    == :: Zord64 -> Zord64 -> Bool
    $c/= :: Zord64 -> Zord64 -> Bool
    /= :: Zord64 -> Zord64 -> Bool
    Eq, Eq Zord64
    Eq Zord64 =>
    (Zord64 -> Zord64 -> Ordering)
    -> (Zord64 -> Zord64 -> Bool)
    -> (Zord64 -> Zord64 -> Bool)
    -> (Zord64 -> Zord64 -> Bool)
    -> (Zord64 -> Zord64 -> Bool)
    -> (Zord64 -> Zord64 -> Zord64)
    -> (Zord64 -> Zord64 -> Zord64)
    -> Ord Zord64
    Zord64 -> Zord64 -> Bool
    Zord64 -> Zord64 -> Ordering
    Zord64 -> Zord64 -> Zord64
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Zord64 -> Zord64 -> Ordering
    compare :: Zord64 -> Zord64 -> Ordering
    $c< :: Zord64 -> Zord64 -> Bool
    < :: Zord64 -> Zord64 -> Bool
    $c<= :: Zord64 -> Zord64 -> Bool
    <= :: Zord64 -> Zord64 -> Bool
    $c> :: Zord64 -> Zord64 -> Bool
    > :: Zord64 -> Zord64 -> Bool
    $c>= :: Zord64 -> Zord64 -> Bool
    >= :: Zord64 -> Zord64 -> Bool
    $cmax :: Zord64 -> Zord64 -> Zord64
    max :: Zord64 -> Zord64 -> Zord64
    $cmin :: Zord64 -> Zord64 -> Zord64
    min :: Zord64 -> Zord64 -> Zord64
    Ord, Zord64
    Zord64 -> Zord64 -> Bounded Zord64
    forall a. a -> a -> Bounded a
    $cminBound :: Zord64
    minBound :: Zord64
    $cmaxBound :: Zord64
    maxBound :: Zord64
    Bounded)

    w64ToInteger :: Zord64 -> Integer
    w64ToInteger :: Zord64 -> Integer
    w64ToInteger W64{lo :: Zord64 -> Word32
    lo=Word32
    lo,hi :: Zord64 -> Word32
    hi=Word32
    hi} = Word32 -> Integer
    forall a. Integral a => a -> Integer
    toInteger Word32
    lo Integer -> Integer -> Integer
    forall a. Num a => a -> a -> a
    + Integer
    0x100000000 Integer -> Integer -> Integer
    forall a. Num a => a -> a -> a
    * Word32 -> Integer
    forall a. Integral a => a -> Integer
    toInteger Word32
    hi

    integerToW64 :: Integer -> Zord64
    integerToW64 :: Integer -> Zord64
    integerToW64 Integer
    x = case Integer
    x Integer -> Integer -> (Integer, Integer)
    forall a. Integral a => a -> a -> (a, a)
    `quotRem` Integer
    0x100000000 of
                     (Integer
    h,Integer
    l) -> W64{lo :: Word32
    lo=Integer -> Word32
    forall a. Num a => Integer -> a
    fromInteger Integer
    l, hi :: Word32
    hi=Integer -> Word32
    forall a. Num a => Integer -> a
    fromInteger Integer
    h}

    instance Show Zord64

    instance Read Zord64

    instance Num Zord64 where
     W64{lo :: Zord64 -> Word32
    lo=Word32
    lo_a,hi :: Zord64 -> Word32
    hi=Word32
    hi_a} + :: Zord64 -> Zord64 -> Zord64
    + W64{lo :: Zord64 -> Word32
    lo=Word32
    lo_b,hi :: Zord64 -> Word32
    hi=Word32
    hi_b} = W64{lo :: Word32
    lo=Word32
    lo', hi :: Word32
    hi=Word32
    hi'}
      where lo' :: Word32
    lo' = Word32
    lo_a Word32 -> Word32 -> Word32
    forall a. Num a => a -> a -> a
    + Word32
    lo_b
            hi' :: Word32
    hi' = Word32
    hi_a Word32 -> Word32 -> Word32
    forall a. Num a => a -> a -> a
    + Word32
    hi_b Word32 -> Word32 -> Word32
    forall a. Num a => a -> a -> a
    + if Word32
    lo' Word32 -> Word32 -> Bool
    forall a. Ord a => a -> a -> Bool
    < Word32
    lo_a then Word32
    1 else Word32
    0
     W64{lo :: Zord64 -> Word32
    lo=Word32
    lo_a,hi :: Zord64 -> Word32
    hi=Word32
    hi_a} - :: Zord64 -> Zord64 -> Zord64
    - W64{lo :: Zord64 -> Word32
    lo=Word32
    lo_b,hi :: Zord64 -> Word32
    hi=Word32
    hi_b} = W64{lo :: Word32
    lo=Word32
    lo', hi :: Word32
    hi=Word32
    hi'}
      where lo' :: Word32
    lo' = Word32
    lo_a Word32 -> Word32 -> Word32
    forall a. Num a => a -> a -> a
    - Word32
    lo_b
            hi' :: Word32
    hi' = Word32
    hi_a Word32 -> Word32 -> Word32
    forall a. Num a => a -> a -> a
    - Word32
    hi_b Word32 -> Word32 -> Word32
    forall a. Num a => a -> a -> a
    + if Word32
    lo' Word32 -> Word32 -> Bool
    forall a. Ord a => a -> a -> Bool
    > Word32
    lo_a then Word32
    1 else Word32
    0
     fromInteger :: Integer -> Zord64
    fromInteger = Integer -> Zord64
    integerToW64

    instance Bits Zord64 where
     W64{lo :: Zord64 -> Word32
    lo=Word32
    lo_a,hi :: Zord64 -> Word32
    hi=Word32
    hi_a} .&. :: Zord64 -> Zord64 -> Zord64
    .&. W64{lo :: Zord64 -> Word32
    lo=Word32
    lo_b,hi :: Zord64 -> Word32
    hi=Word32
    hi_b} = W64{lo :: Word32
    lo=Word32
    lo', hi :: Word32
    hi=Word32
    hi'}
      where lo' :: Word32
    lo' = Word32
    lo_a Word32 -> Word32 -> Word32
    forall a. Bits a => a -> a -> a
    .&. Word32
    lo_b
            hi' :: Word32
    hi' = Word32
    hi_a Word32 -> Word32 -> Word32
    forall a. Bits a => a -> a -> a
    .&. Word32
    hi_b
     W64{lo :: Zord64 -> Word32
    lo=Word32
    lo_a,hi :: Zord64 -> Word32
    hi=Word32
    hi_a} .|. :: Zord64 -> Zord64 -> Zord64
    .|. W64{lo :: Zord64 -> Word32
    lo=Word32
    lo_b,hi :: Zord64 -> Word32
    hi=Word32
    hi_b} = W64{lo :: Word32
    lo=Word32
    lo', hi :: Word32
    hi=Word32
    hi'}
      where lo' :: Word32
    lo' = Word32
    lo_a Word32 -> Word32 -> Word32
    forall a. Bits a => a -> a -> a
    .|. Word32
    lo_b
            hi' :: Word32
    hi' = Word32
    hi_a Word32 -> Word32 -> Word32
    forall a. Bits a => a -> a -> a
    .|. Word32
    hi_b
     shift :: Zord64 -> Int -> Zord64
    shift w :: Zord64
    w@W64{lo :: Zord64 -> Word32
    lo=Word32
    lo,hi :: Zord64 -> Word32
    hi=Word32
    hi} Int
    x
      | Int
    x Int -> Int -> Bool
    forall a. Eq a => a -> a -> Bool
    == Int
    0 = Zord64
    w
      | Int
    x Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    63 = W64{lo :: Word32
    lo=Word32
    0,hi :: Word32
    hi=Word32
    0}
      | Int
    x Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    31 = W64{lo :: Word32
    lo = Word32
    0, hi :: Word32
    hi = Word32 -> Int -> Word32
    forall a. Bits a => a -> Int -> a
    shift Word32
    lo (Int
    xInt -> Int -> Int
    forall a. Num a => a -> a -> a
    -Int
    32)}
      | Int
    x Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    > Int
    0 = W64{lo :: Word32
    lo = Word32 -> Int -> Word32
    forall a. Bits a => a -> Int -> a
    shift Word32
    lo Int
    x, hi :: Word32
    hi = Word32 -> Int -> Word32
    forall a. Bits a => a -> Int -> a
    shift Word32
    hi Int
    x Word32 -> Word32 -> Word32
    forall a. Bits a => a -> a -> a
    .|. Word32 -> Int -> Word32
    forall a. Bits a => a -> Int -> a
    shift Word32
    lo (Int
    xInt -> Int -> Int
    forall a. Num a => a -> a -> a
    -Int
    32)}
      | Int
    x Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < -Int
    63 = W64{lo :: Word32
    lo=Word32
    0,hi :: Word32
    hi=Word32
    0}
      | Int
    x Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < -Int
    31 = W64{lo :: Word32
    lo = Word32 -> Int -> Word32
    forall a. Bits a => a -> Int -> a
    shift Word32
    hi (Int
    xInt -> Int -> Int
    forall a. Num a => a -> a -> a
    +Int
    32), hi :: Word32
    hi = Word32
    0}
      | Int
    x Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    < Int
    0 = W64{lo :: Word32
    lo = Word32 -> Int -> Word32
    forall a. Bits a => a -> Int -> a
    shift Word32
    lo Int
    x Word32 -> Word32 -> Word32
    forall a. Bits a => a -> a -> a
    .|. Word32 -> Int -> Word32
    forall a. Bits a => a -> Int -> a
    shift Word32
    hi (Int
    xInt -> Int -> Int
    forall a. Num a => a -> a -> a
    +Int
    32), hi :: Word32
    hi = Word32 -> Int -> Word32
    forall a. Bits a => a -> Int -> a
    shift Word32
    hi Int
    x}
      | Bool
    otherwise = String -> Zord64
    forall a. HasCallStack => String -> a
    error String
    "impossible"
     complement :: Zord64 -> Zord64
    complement W64{lo :: Zord64 -> Word32
    lo=Word32
    lo,hi :: Zord64 -> Word32
    hi=Word32
    hi} = W64{lo :: Word32
    lo=Word32 -> Word32
    forall a. Bits a => a -> a
    complement Word32
    lo,hi :: Word32
    hi=Word32 -> Word32
    forall a. Bits a => a -> a
    complement Word32
    hi}

    instance Integral Zord64 where
     toInteger :: Zord64 -> Integer
    toInteger = Zord64 -> Integer
    w64ToInteger

    instance Real Zord64
    instance Enum Zord64