    {-# LANGUAGE Trustworthy #-}
    {-# LANGUAGE CPP, NoImplicitPrelude, BangPatterns, MagicHash, UnboxedTuples #-}
    {-# OPTIONS_HADDOCK not-home #-}

    -----------------------------------------------------------------------------
    -- |
    -- Module      :  GHC.Word
    -- Copyright   :  (c) The University of Glasgow, 1997-2002
    -- License     :  see libraries/base/LICENSE
    --
    -- Maintainer  :  cvs-ghc@haskell.org
    -- Stability   :  internal
    -- Portability :  non-portable (GHC Extensions)
    --
    -- Sized unsigned integral types: 'Word', 'Word8', 'Word16', 'Word32', and
    -- 'Word64'.
    --
    -----------------------------------------------------------------------------

    #include "MachDeps.h"

    module GHC.Word (
        Word(..), Word8(..), Word16(..), Word32(..), Word64(..),

        -- * Shifts
        uncheckedShiftL64#,
        uncheckedShiftRL64#,

        -- * Byte swapping
        byteSwap16,
        byteSwap32,
        byteSwap64,

        -- * Bit reversal
        bitReverse8,
        bitReverse16,
        bitReverse32,
        bitReverse64,

        -- * Equality operators
        -- | See GHC.Classes#matching_overloaded_methods_in_rules
        eqWord, neWord, gtWord, geWord, ltWord, leWord,
        eqWord8, neWord8, gtWord8, geWord8, ltWord8, leWord8,
        eqWord16, neWord16, gtWord16, geWord16, ltWord16, leWord16,
        eqWord32, neWord32, gtWord32, geWord32, ltWord32, leWord32,
        eqWord64, neWord64, gtWord64, geWord64, ltWord64, leWord64
        ) where

    import Data.Maybe

    #if WORD_SIZE_IN_BITS < 64
    import GHC.Prim
    #endif

    import GHC.Base
    import GHC.Bits
    import GHC.Enum
    import GHC.Num
    import GHC.Real
    import GHC.Ix
    import GHC.Show

    ------------------------------------------------------------------------
    -- type Word8
    ------------------------------------------------------------------------

    -- Word8 is represented in the same way as Word. Operations may assume
    -- and must ensure that it holds only values from its logical range.

    data {-# CTYPE "HsWord8" #-} Word8
        = W8# Word8#

    -- ^ 8-bit unsigned integer type

    -- See GHC.Classes#matching_overloaded_methods_in_rules
    -- | @since 2.01
    instance Eq Word8 where
        == :: Word8 -> Word8 -> Bool
    (==) = Word8 -> Word8 -> Bool
    eqWord8
        /= :: Word8 -> Word8 -> Bool
    (/=) = Word8 -> Word8 -> Bool
    neWord8

    eqWord8, neWord8 :: Word8 -> Word8 -> Bool
    eqWord8 :: Word8 -> Word8 -> Bool
    eqWord8 (W8# Word8#
    x) (W8# Word8#
    y) = Int# -> Bool
    isTrue# ((Word8# -> Word#
    word8ToWord# Word8#
    x) Word# -> Word# -> Int#
    `eqWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y))
    neWord8 :: Word8 -> Word8 -> Bool
    neWord8 (W8# Word8#
    x) (W8# Word8#
    y) = Int# -> Bool
    isTrue# ((Word8# -> Word#
    word8ToWord# Word8#
    x) Word# -> Word# -> Int#
    `neWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y))
    {-# INLINE [1] eqWord8 #-}
    {-# INLINE [1] neWord8 #-}

    -- | @since 2.01
    instance Ord Word8 where
        < :: Word8 -> Word8 -> Bool
    (<)  = Word8 -> Word8 -> Bool
    ltWord8
        <= :: Word8 -> Word8 -> Bool
    (<=) = Word8 -> Word8 -> Bool
    leWord8
        >= :: Word8 -> Word8 -> Bool
    (>=) = Word8 -> Word8 -> Bool
    geWord8
        > :: Word8 -> Word8 -> Bool
    (>)  = Word8 -> Word8 -> Bool
    gtWord8

    {-# INLINE [1] gtWord8 #-}
    {-# INLINE [1] geWord8 #-}
    {-# INLINE [1] ltWord8 #-}
    {-# INLINE [1] leWord8 #-}
    gtWord8, geWord8, ltWord8, leWord8 :: Word8 -> Word8 -> Bool
    (W8# Word8#
    x) gtWord8 :: Word8 -> Word8 -> Bool
    `gtWord8` (W8# Word8#
    y) = Int# -> Bool
    isTrue# (Word8#
    x Word8# -> Word8# -> Int#
    `gtWord8#` Word8#
    y)
    (W8# Word8#
    x) geWord8 :: Word8 -> Word8 -> Bool
    `geWord8` (W8# Word8#
    y) = Int# -> Bool
    isTrue# (Word8#
    x Word8# -> Word8# -> Int#
    `geWord8#` Word8#
    y)
    (W8# Word8#
    x) ltWord8 :: Word8 -> Word8 -> Bool
    `ltWord8` (W8# Word8#
    y) = Int# -> Bool
    isTrue# (Word8#
    x Word8# -> Word8# -> Int#
    `ltWord8#` Word8#
    y)
    (W8# Word8#
    x) leWord8 :: Word8 -> Word8 -> Bool
    `leWord8` (W8# Word8#
    y) = Int# -> Bool
    isTrue# (Word8#
    x Word8# -> Word8# -> Int#
    `leWord8#` Word8#
    y)

    -- | @since 2.01
    instance Show Word8 where
        showsPrec :: Int -> Word8 -> ShowS
    showsPrec Int
    p Word8
    x = forall a. Show a => Int -> a -> ShowS
    showsPrec Int
    p (forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word8
    x :: Int)

    -- | @since 2.01
    instance Num Word8 where
        (W8# Word8#
    x#) + :: Word8 -> Word8 -> Word8
    + (W8# Word8#
    y#)    = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `plusWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
        (W8# Word8#
    x#) - :: Word8 -> Word8 -> Word8
    - (W8# Word8#
    y#)    = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `minusWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
        (W8# Word8#
    x#) * :: Word8 -> Word8 -> Word8
    * (W8# Word8#
    y#)    = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `timesWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
        negate :: Word8 -> Word8
    negate (W8# Word8#
    x#)        = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# (Int# -> Word#
    int2Word# (Int# -> Int#
    negateInt# (Word# -> Int#
    word2Int# ((Word8# -> Word#
    word8ToWord# Word8#
    x#))))))
        abs :: Word8 -> Word8
    abs Word8
    x                  = Word8
    x
        signum :: Word8 -> Word8
    signum Word8
    0               = Word8
    0
        signum Word8
    _               = Word8
    1
        fromInteger :: Integer -> Word8
    fromInteger Integer
    i          = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# (Integer -> Word#
    integerToWord# Integer
    i))

    -- | @since 2.01
    instance Real Word8 where
        toRational :: Word8 -> Rational
    toRational Word8
    x = forall a. Integral a => a -> Integer
    toInteger Word8
    x forall a. Integral a => a -> a -> Ratio a
    % Integer
    1

    -- | @since 2.01
    instance Enum Word8 where
        succ :: Word8 -> Word8
    succ Word8
    x
            | Word8
    x forall a. Eq a => a -> a -> Bool
    /= forall a. Bounded a => a
    maxBound = Word8
    x forall a. Num a => a -> a -> a
    + Word8
    1
            | Bool
    otherwise     = forall a. String -> a
    succError String
    "Word8"
        pred :: Word8 -> Word8
    pred Word8
    x
            | Word8
    x forall a. Eq a => a -> a -> Bool
    /= forall a. Bounded a => a
    minBound = Word8
    x forall a. Num a => a -> a -> a
    - Word8
    1
            | Bool
    otherwise     = forall a. String -> a
    predError String
    "Word8"
        toEnum :: Int -> Word8
    toEnum i :: Int
    i@(I# Int#
    i#)
            | Int
    i forall a. Ord a => a -> a -> Bool
    >= Int
    0 Bool -> Bool -> Bool
    && Int
    i forall a. Ord a => a -> a -> Bool
    <= forall a b. (Integral a, Num b) => a -> b
    fromIntegral (forall a. Bounded a => a
    maxBound::Word8)
                            = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# (Int# -> Word#
    int2Word# Int#
    i#))
            | Bool
    otherwise     = forall a b. Show a => String -> Int -> (a, a) -> b
    toEnumError String
    "Word8" Int
    i (forall a. Bounded a => a
    minBound::Word8, forall a. Bounded a => a
    maxBound::Word8)
        fromEnum :: Word8 -> Int
    fromEnum (W8# Word8#
    x#)   = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word8# -> Word#
    word8ToWord# Word8#
    x#))
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFrom #-}
        enumFrom :: Word8 -> [Word8]
    enumFrom            = forall a. (Enum a, Bounded a) => a -> [a]
    boundedEnumFrom
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFromThen #-}
        enumFromThen :: Word8 -> Word8 -> [Word8]
    enumFromThen        = forall a. (Enum a, Bounded a) => a -> a -> [a]
    boundedEnumFromThen

    -- | @since 2.01
    instance Integral Word8 where
        quot :: Word8 -> Word8 -> Word8
    quot    (W8# Word8#
    x#) y :: Word8
    y@(W8# Word8#
    y#)
            | Word8
    y forall a. Eq a => a -> a -> Bool
    /= Word8
    0                  = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `quotWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
            | Bool
    otherwise               = forall a. a
    divZeroError
        rem :: Word8 -> Word8 -> Word8
    rem     (W8# Word8#
    x#) y :: Word8
    y@(W8# Word8#
    y#)
            | Word8
    y forall a. Eq a => a -> a -> Bool
    /= Word8
    0                  = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `remWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
            | Bool
    otherwise               = forall a. a
    divZeroError
        div :: Word8 -> Word8 -> Word8
    div     (W8# Word8#
    x#) y :: Word8
    y@(W8# Word8#
    y#)
            | Word8
    y forall a. Eq a => a -> a -> Bool
    /= Word8
    0                  = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `quotWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
            | Bool
    otherwise               = forall a. a
    divZeroError
        mod :: Word8 -> Word8 -> Word8
    mod     (W8# Word8#
    x#) y :: Word8
    y@(W8# Word8#
    y#)
            | Word8
    y forall a. Eq a => a -> a -> Bool
    /= Word8
    0                  = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `remWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
            | Bool
    otherwise               = forall a. a
    divZeroError
        quotRem :: Word8 -> Word8 -> (Word8, Word8)
    quotRem (W8# Word8#
    x#) y :: Word8
    y@(W8# Word8#
    y#)
            | Word8
    y forall a. Eq a => a -> a -> Bool
    /= Word8
    0                  = case (Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> (# Word#, Word# #)
    `quotRemWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#) of
                                        (# Word#
    q, Word#
    r #) ->
                                            (Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# Word#
    q), Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# Word#
    r))
            | Bool
    otherwise               = forall a. a
    divZeroError
        divMod :: Word8 -> Word8 -> (Word8, Word8)
    divMod  (W8# Word8#
    x#) y :: Word8
    y@(W8# Word8#
    y#)
            | Word8
    y forall a. Eq a => a -> a -> Bool
    /= Word8
    0                  = (Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `quotWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
                                        ,Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `remWord#` (Word8# -> Word#
    word8ToWord# Word8#
    y#))))
            | Bool
    otherwise               = forall a. a
    divZeroError
        toInteger :: Word8 -> Integer
    toInteger (W8# Word8#
    x#)            = Int# -> Integer
    IS (Word# -> Int#
    word2Int# (Word8# -> Word#
    word8ToWord# Word8#
    x#))

    -- | @since 2.01
    instance Bounded Word8 where
        minBound :: Word8
    minBound = Word8
    0
        maxBound :: Word8
    maxBound = Word8
    0xFF

    -- | @since 2.01
    instance Ix Word8 where
        range :: (Word8, Word8) -> [Word8]
    range (Word8
    m,Word8
    n)         = [Word8
    m..Word8
    n]
        unsafeIndex :: (Word8, Word8) -> Word8 -> Int
    unsafeIndex (Word8
    m,Word8
    _) Word8
    i = forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Word8
    i forall a. Num a => a -> a -> a
    - Word8
    m)
        inRange :: (Word8, Word8) -> Word8 -> Bool
    inRange (Word8
    m,Word8
    n) Word8
    i     = Word8
    m forall a. Ord a => a -> a -> Bool
    <= Word8
    i Bool -> Bool -> Bool
    && Word8
    i forall a. Ord a => a -> a -> Bool
    <= Word8
    n

    -- | @since 2.01
    instance Bits Word8 where
        {-# INLINE shift #-}
        {-# INLINE bit #-}
        {-# INLINE testBit #-}
        {-# INLINE popCount #-}

        (W8# Word8#
    x#) .&. :: Word8 -> Word8 -> Word8
    .&.   (W8# Word8#
    y#)   = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `and#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
        (W8# Word8#
    x#) .|. :: Word8 -> Word8 -> Word8
    .|.   (W8# Word8#
    y#)   = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `or#`  (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
        (W8# Word8#
    x#) xor :: Word8 -> Word8 -> Word8
    `xor` (W8# Word8#
    y#)   = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Word# -> Word#
    `xor#` (Word8# -> Word#
    word8ToWord# Word8#
    y#)))
        complement :: Word8 -> Word8
    complement (W8# Word8#
    x#)       = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# (Word# -> Word#
    not# (Word8# -> Word#
    word8ToWord# Word8#
    x#)))
        (W8# Word8#
    x#) shift :: Word8 -> Int -> Word8
    `shift` (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#) = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Int# -> Word#
    `shiftL#` Int#
    i#))
            | Bool
    otherwise           = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Int# -> Word#
    `shiftRL#` Int# -> Int#
    negateInt# Int#
    i#))
        (W8# Word8#
    x#) shiftL :: Word8 -> Int -> Word8
    `shiftL`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#) = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Int# -> Word#
    `shiftL#` Int#
    i#))
            | Bool
    otherwise           = forall a. a
    overflowError
        (W8# Word8#
    x#) unsafeShiftL :: Word8 -> Int -> Word8
    `unsafeShiftL` (I# Int#
    i#) =
            Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftL#` Int#
    i#))
        (W8# Word8#
    x#) shiftR :: Word8 -> Int -> Word8
    `shiftR`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#) = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Int# -> Word#
    `shiftRL#` Int#
    i#))
            | Bool
    otherwise           = forall a. a
    overflowError
        (W8# Word8#
    x#) unsafeShiftR :: Word8 -> Int -> Word8
    `unsafeShiftR` (I# Int#
    i#) = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftRL#` Int#
    i#))
        (W8# Word8#
    x#) rotate :: Word8 -> Int -> Word8
    `rotate`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i'# Int# -> Int# -> Int#
    ==# Int#
    0#) = Word8# -> Word8
    W8# Word8#
    x#
            | Bool
    otherwise  = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# (((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftL#` Int#
    i'#) Word# -> Word# -> Word#
    `or#`
                                              ((Word8# -> Word#
    word8ToWord# Word8#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftRL#` (Int#
    8# Int# -> Int# -> Int#
    -# Int#
    i'#))))
            where
            !i'# :: Int#
    i'# = Word# -> Int#
    word2Int# (Int# -> Word#
    int2Word# Int#
    i# Word# -> Word# -> Word#
    `and#` Word#
    7##)
        bitSizeMaybe :: Word8 -> Maybe Int
    bitSizeMaybe Word8
    i            = forall a. a -> Maybe a
    Just (forall b. FiniteBits b => b -> Int
    finiteBitSize Word8
    i)
        bitSize :: Word8 -> Int
    bitSize Word8
    i                 = forall b. FiniteBits b => b -> Int
    finiteBitSize Word8
    i
        isSigned :: Word8 -> Bool
    isSigned Word8
    _                = Bool
    False
        popCount :: Word8 -> Int
    popCount (W8# Word8#
    x#)         = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    popCnt8# (Word8# -> Word#
    word8ToWord# Word8#
    x#)))
        bit :: Int -> Word8
    bit                       = forall a. (Bits a, Num a) => Int -> a
    bitDefault
        testBit :: Word8 -> Int -> Bool
    testBit                   = forall a. (Bits a, Num a) => a -> Int -> Bool
    testBitDefault

    -- | @since 4.6.0.0
    instance FiniteBits Word8 where
        {-# INLINE countLeadingZeros #-}
        {-# INLINE countTrailingZeros #-}
        finiteBitSize :: Word8 -> Int
    finiteBitSize Word8
    _ = Int
    8
        countLeadingZeros :: Word8 -> Int
    countLeadingZeros  (W8# Word8#
    x#) = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    clz8# (Word8# -> Word#
    word8ToWord# Word8#
    x#)))
        countTrailingZeros :: Word8 -> Int
    countTrailingZeros (W8# Word8#
    x#) = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    ctz8# (Word8# -> Word#
    word8ToWord# Word8#
    x#)))

    {-# RULES
    "properFraction/Float->(Word8,Float)"
        properFraction = \x ->
                          case properFraction x of {
                            (n, y) -> ((fromIntegral :: Int -> Word8) n, y :: Float) }
    "truncate/Float->Word8"
        truncate = (fromIntegral :: Int -> Word8) . (truncate :: Float -> Int)
    "floor/Float->Word8"
        floor    = (fromIntegral :: Int -> Word8) . (floor :: Float -> Int)
    "ceiling/Float->Word8"
        ceiling  = (fromIntegral :: Int -> Word8) . (ceiling :: Float -> Int)
    "round/Float->Word8"
        round    = (fromIntegral :: Int -> Word8) . (round  :: Float -> Int)
      #-}

    {-# RULES
    "properFraction/Double->(Word8,Double)"
        properFraction = \x ->
                          case properFraction x of {
                            (n, y) -> ((fromIntegral :: Int -> Word8) n, y :: Double) }
    "truncate/Double->Word8"
        truncate = (fromIntegral :: Int -> Word8) . (truncate :: Double -> Int)
    "floor/Double->Word8"
        floor    = (fromIntegral :: Int -> Word8) . (floor :: Double -> Int)
    "ceiling/Double->Word8"
        ceiling  = (fromIntegral :: Int -> Word8) . (ceiling :: Double -> Int)
    "round/Double->Word8"
        round    = (fromIntegral :: Int -> Word8) . (round  :: Double -> Int)
      #-}

    ------------------------------------------------------------------------
    -- type Word16
    ------------------------------------------------------------------------

    -- Word16 is represented in the same way as Word. Operations may assume
    -- and must ensure that it holds only values from its logical range.

    data {-# CTYPE "HsWord16" #-} Word16 = W16# Word16#
    -- ^ 16-bit unsigned integer type

    -- See GHC.Classes#matching_overloaded_methods_in_rules
    -- | @since 2.01
    instance Eq Word16 where
        == :: Word16 -> Word16 -> Bool
    (==) = Word16 -> Word16 -> Bool
    eqWord16
        /= :: Word16 -> Word16 -> Bool
    (/=) = Word16 -> Word16 -> Bool
    neWord16

    eqWord16, neWord16 :: Word16 -> Word16 -> Bool
    eqWord16 :: Word16 -> Word16 -> Bool
    eqWord16 (W16# Word16#
    x) (W16# Word16#
    y) = Int# -> Bool
    isTrue# ((Word16# -> Word#
    word16ToWord# Word16#
    x) Word# -> Word# -> Int#
    `eqWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y))
    neWord16 :: Word16 -> Word16 -> Bool
    neWord16 (W16# Word16#
    x) (W16# Word16#
    y) = Int# -> Bool
    isTrue# ((Word16# -> Word#
    word16ToWord# Word16#
    x) Word# -> Word# -> Int#
    `neWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y))
    {-# INLINE [1] eqWord16 #-}
    {-# INLINE [1] neWord16 #-}

    -- | @since 2.01
    instance Ord Word16 where
        < :: Word16 -> Word16 -> Bool
    (<)  = Word16 -> Word16 -> Bool
    ltWord16
        <= :: Word16 -> Word16 -> Bool
    (<=) = Word16 -> Word16 -> Bool
    leWord16
        >= :: Word16 -> Word16 -> Bool
    (>=) = Word16 -> Word16 -> Bool
    geWord16
        > :: Word16 -> Word16 -> Bool
    (>)  = Word16 -> Word16 -> Bool
    gtWord16

    {-# INLINE [1] gtWord16 #-}
    {-# INLINE [1] geWord16 #-}
    {-# INLINE [1] ltWord16 #-}
    {-# INLINE [1] leWord16 #-}
    gtWord16, geWord16, ltWord16, leWord16 :: Word16 -> Word16 -> Bool
    (W16# Word16#
    x) gtWord16 :: Word16 -> Word16 -> Bool
    `gtWord16` (W16# Word16#
    y) = Int# -> Bool
    isTrue# (Word16#
    x Word16# -> Word16# -> Int#
    `gtWord16#` Word16#
    y)
    (W16# Word16#
    x) geWord16 :: Word16 -> Word16 -> Bool
    `geWord16` (W16# Word16#
    y) = Int# -> Bool
    isTrue# (Word16#
    x Word16# -> Word16# -> Int#
    `geWord16#` Word16#
    y)
    (W16# Word16#
    x) ltWord16 :: Word16 -> Word16 -> Bool
    `ltWord16` (W16# Word16#
    y) = Int# -> Bool
    isTrue# (Word16#
    x Word16# -> Word16# -> Int#
    `ltWord16#` Word16#
    y)
    (W16# Word16#
    x) leWord16 :: Word16 -> Word16 -> Bool
    `leWord16` (W16# Word16#
    y) = Int# -> Bool
    isTrue# (Word16#
    x Word16# -> Word16# -> Int#
    `leWord16#` Word16#
    y)

    -- | @since 2.01
    instance Show Word16 where
        showsPrec :: Int -> Word16 -> ShowS
    showsPrec Int
    p Word16
    x = forall a. Show a => Int -> a -> ShowS
    showsPrec Int
    p (forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word16
    x :: Int)

    -- | @since 2.01
    instance Num Word16 where
        (W16# Word16#
    x#) + :: Word16 -> Word16 -> Word16
    + (W16# Word16#
    y#)  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `plusWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
        (W16# Word16#
    x#) - :: Word16 -> Word16 -> Word16
    - (W16# Word16#
    y#)  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `minusWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
        (W16# Word16#
    x#) * :: Word16 -> Word16 -> Word16
    * (W16# Word16#
    y#)  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `timesWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
        negate :: Word16 -> Word16
    negate (W16# Word16#
    x#)       = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# (Int# -> Word#
    int2Word# (Int# -> Int#
    negateInt# (Word# -> Int#
    word2Int# (Word16# -> Word#
    word16ToWord# Word16#
    x#)))))
        abs :: Word16 -> Word16
    abs Word16
    x                  = Word16
    x
        signum :: Word16 -> Word16
    signum Word16
    0               = Word16
    0
        signum Word16
    _               = Word16
    1
        fromInteger :: Integer -> Word16
    fromInteger Integer
    i          = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# (Integer -> Word#
    integerToWord# Integer
    i))

    -- | @since 2.01
    instance Real Word16 where
        toRational :: Word16 -> Rational
    toRational Word16
    x = forall a. Integral a => a -> Integer
    toInteger Word16
    x forall a. Integral a => a -> a -> Ratio a
    % Integer
    1

    -- | @since 2.01
    instance Enum Word16 where
        succ :: Word16 -> Word16
    succ Word16
    x
            | Word16
    x forall a. Eq a => a -> a -> Bool
    /= forall a. Bounded a => a
    maxBound = Word16
    x forall a. Num a => a -> a -> a
    + Word16
    1
            | Bool
    otherwise     = forall a. String -> a
    succError String
    "Word16"
        pred :: Word16 -> Word16
    pred Word16
    x
            | Word16
    x forall a. Eq a => a -> a -> Bool
    /= forall a. Bounded a => a
    minBound = Word16
    x forall a. Num a => a -> a -> a
    - Word16
    1
            | Bool
    otherwise     = forall a. String -> a
    predError String
    "Word16"
        toEnum :: Int -> Word16
    toEnum i :: Int
    i@(I# Int#
    i#)
            | Int
    i forall a. Ord a => a -> a -> Bool
    >= Int
    0 Bool -> Bool -> Bool
    && Int
    i forall a. Ord a => a -> a -> Bool
    <= forall a b. (Integral a, Num b) => a -> b
    fromIntegral (forall a. Bounded a => a
    maxBound::Word16)
                            = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# (Int# -> Word#
    int2Word# Int#
    i#))
            | Bool
    otherwise     = forall a b. Show a => String -> Int -> (a, a) -> b
    toEnumError String
    "Word16" Int
    i (forall a. Bounded a => a
    minBound::Word16, forall a. Bounded a => a
    maxBound::Word16)
        fromEnum :: Word16 -> Int
    fromEnum (W16# Word16#
    x#)  = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word16# -> Word#
    word16ToWord# Word16#
    x#))
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFrom #-}
        enumFrom :: Word16 -> [Word16]
    enumFrom            = forall a. (Enum a, Bounded a) => a -> [a]
    boundedEnumFrom
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFromThen #-}
        enumFromThen :: Word16 -> Word16 -> [Word16]
    enumFromThen        = forall a. (Enum a, Bounded a) => a -> a -> [a]
    boundedEnumFromThen

    -- | @since 2.01
    instance Integral Word16 where
        quot :: Word16 -> Word16 -> Word16
    quot    (W16# Word16#
    x#) y :: Word16
    y@(W16# Word16#
    y#)
            | Word16
    y forall a. Eq a => a -> a -> Bool
    /= Word16
    0                    = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `quotWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        rem :: Word16 -> Word16 -> Word16
    rem     (W16# Word16#
    x#) y :: Word16
    y@(W16# Word16#
    y#)
            | Word16
    y forall a. Eq a => a -> a -> Bool
    /= Word16
    0                    = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `remWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        div :: Word16 -> Word16 -> Word16
    div     (W16# Word16#
    x#) y :: Word16
    y@(W16# Word16#
    y#)
            | Word16
    y forall a. Eq a => a -> a -> Bool
    /= Word16
    0                    = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `quotWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        mod :: Word16 -> Word16 -> Word16
    mod     (W16# Word16#
    x#) y :: Word16
    y@(W16# Word16#
    y#)
            | Word16
    y forall a. Eq a => a -> a -> Bool
    /= Word16
    0                    = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `remWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        quotRem :: Word16 -> Word16 -> (Word16, Word16)
    quotRem (W16# Word16#
    x#) y :: Word16
    y@(W16# Word16#
    y#)
            | Word16
    y forall a. Eq a => a -> a -> Bool
    /= Word16
    0                  = case (Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> (# Word#, Word# #)
    `quotRemWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#) of
                                        (# Word#
    q, Word#
    r #) ->
                                            (Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# Word#
    q), Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# Word#
    r))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        divMod :: Word16 -> Word16 -> (Word16, Word16)
    divMod  (W16# Word16#
    x#) y :: Word16
    y@(W16# Word16#
    y#)
            | Word16
    y forall a. Eq a => a -> a -> Bool
    /= Word16
    0                    = (Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `quotWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
                                          ,Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `remWord#` (Word16# -> Word#
    word16ToWord# Word16#
    y#))))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        toInteger :: Word16 -> Integer
    toInteger (W16# Word16#
    x#)             = Int# -> Integer
    IS (Word# -> Int#
    word2Int# (Word16# -> Word#
    word16ToWord# Word16#
    x#))

    -- | @since 2.01
    instance Bounded Word16 where
        minBound :: Word16
    minBound = Word16
    0
        maxBound :: Word16
    maxBound = Word16
    0xFFFF

    -- | @since 2.01
    instance Ix Word16 where
        range :: (Word16, Word16) -> [Word16]
    range (Word16
    m,Word16
    n)         = [Word16
    m..Word16
    n]
        unsafeIndex :: (Word16, Word16) -> Word16 -> Int
    unsafeIndex (Word16
    m,Word16
    _) Word16
    i = forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Word16
    i forall a. Num a => a -> a -> a
    - Word16
    m)
        inRange :: (Word16, Word16) -> Word16 -> Bool
    inRange (Word16
    m,Word16
    n) Word16
    i     = Word16
    m forall a. Ord a => a -> a -> Bool
    <= Word16
    i Bool -> Bool -> Bool
    && Word16
    i forall a. Ord a => a -> a -> Bool
    <= Word16
    n

    -- | @since 2.01
    instance Bits Word16 where
        {-# INLINE shift #-}
        {-# INLINE bit #-}
        {-# INLINE testBit #-}
        {-# INLINE popCount #-}

        (W16# Word16#
    x#) .&. :: Word16 -> Word16 -> Word16
    .&.   (W16# Word16#
    y#)  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `and#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
        (W16# Word16#
    x#) .|. :: Word16 -> Word16 -> Word16
    .|.   (W16# Word16#
    y#)  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `or#`  (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
        (W16# Word16#
    x#) xor :: Word16 -> Word16 -> Word16
    `xor` (W16# Word16#
    y#)  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Word# -> Word#
    `xor#` (Word16# -> Word#
    word16ToWord# Word16#
    y#)))
        complement :: Word16 -> Word16
    complement (W16# Word16#
    x#)       = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# (Word# -> Word#
    not# (Word16# -> Word#
    word16ToWord# Word16#
    x#)))
        (W16# Word16#
    x#) shift :: Word16 -> Int -> Word16
    `shift` (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#)  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Int# -> Word#
    `shiftL#` Int#
    i#))
            | Bool
    otherwise            = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Int# -> Word#
    `shiftRL#` Int# -> Int#
    negateInt# Int#
    i#))
        (W16# Word16#
    x#) shiftL :: Word16 -> Int -> Word16
    `shiftL`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#)  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Int# -> Word#
    `shiftL#` Int#
    i#))
            | Bool
    otherwise            = forall a. a
    overflowError
        (W16# Word16#
    x#) unsafeShiftL :: Word16 -> Int -> Word16
    `unsafeShiftL` (I# Int#
    i#) =
            Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftL#` Int#
    i#))
        (W16# Word16#
    x#) shiftR :: Word16 -> Int -> Word16
    `shiftR`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#)  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Int# -> Word#
    `shiftRL#` Int#
    i#))
            | Bool
    otherwise            = forall a. a
    overflowError
        (W16# Word16#
    x#) unsafeShiftR :: Word16 -> Int -> Word16
    `unsafeShiftR` (I# Int#
    i#) = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftRL#` Int#
    i#))
        (W16# Word16#
    x#) rotate :: Word16 -> Int -> Word16
    `rotate`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i'# Int# -> Int# -> Int#
    ==# Int#
    0#) = Word16# -> Word16
    W16# Word16#
    x#
            | Bool
    otherwise  = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# (((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftL#` Int#
    i'#) Word# -> Word# -> Word#
    `or#`
                                                ((Word16# -> Word#
    word16ToWord# Word16#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftRL#` (Int#
    16# Int# -> Int# -> Int#
    -# Int#
    i'#))))
            where
            !i'# :: Int#
    i'# = Word# -> Int#
    word2Int# (Int# -> Word#
    int2Word# Int#
    i# Word# -> Word# -> Word#
    `and#` Word#
    15##)
        bitSizeMaybe :: Word16 -> Maybe Int
    bitSizeMaybe Word16
    i            = forall a. a -> Maybe a
    Just (forall b. FiniteBits b => b -> Int
    finiteBitSize Word16
    i)
        bitSize :: Word16 -> Int
    bitSize Word16
    i                 = forall b. FiniteBits b => b -> Int
    finiteBitSize Word16
    i
        isSigned :: Word16 -> Bool
    isSigned Word16
    _                = Bool
    False
        popCount :: Word16 -> Int
    popCount (W16# Word16#
    x#)        = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    popCnt16# (Word16# -> Word#
    word16ToWord# Word16#
    x#)))
        bit :: Int -> Word16
    bit                       = forall a. (Bits a, Num a) => Int -> a
    bitDefault
        testBit :: Word16 -> Int -> Bool
    testBit                   = forall a. (Bits a, Num a) => a -> Int -> Bool
    testBitDefault

    -- | @since 4.6.0.0
    instance FiniteBits Word16 where
        {-# INLINE countLeadingZeros #-}
        {-# INLINE countTrailingZeros #-}
        finiteBitSize :: Word16 -> Int
    finiteBitSize Word16
    _ = Int
    16
        countLeadingZeros :: Word16 -> Int
    countLeadingZeros  (W16# Word16#
    x#) = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    clz16# (Word16# -> Word#
    word16ToWord# Word16#
    x#)))
        countTrailingZeros :: Word16 -> Int
    countTrailingZeros (W16# Word16#
    x#) = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    ctz16# (Word16# -> Word#
    word16ToWord# Word16#
    x#)))

    -- | Reverse order of bytes in 'Word16'.
    --
    -- @since 4.7.0.0
    byteSwap16 :: Word16 -> Word16
    byteSwap16 :: Word16 -> Word16
    byteSwap16 (W16# Word16#
    w#) = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# (Word# -> Word#
    byteSwap16# (Word16# -> Word#
    word16ToWord# Word16#
    w#)))

    {-# RULES
    "properFraction/Float->(Word16,Float)"
        properFraction = \x ->
                          case properFraction x of {
                            (n, y) -> ((fromIntegral :: Int -> Word16) n, y :: Float) }
    "truncate/Float->Word16"
        truncate = (fromIntegral :: Int -> Word16) . (truncate :: Float -> Int)
    "floor/Float->Word16"
        floor    = (fromIntegral :: Int -> Word16) . (floor :: Float -> Int)
    "ceiling/Float->Word16"
        ceiling  = (fromIntegral :: Int -> Word16) . (ceiling :: Float -> Int)
    "round/Float->Word16"
        round    = (fromIntegral :: Int -> Word16) . (round  :: Float -> Int)
      #-}

    {-# RULES
    "properFraction/Double->(Word16,Double)"
        properFraction = \x ->
                          case properFraction x of {
                            (n, y) -> ((fromIntegral :: Int -> Word16) n, y :: Double) }
    "truncate/Double->Word16"
        truncate = (fromIntegral :: Int -> Word16) . (truncate :: Double -> Int)
    "floor/Double->Word16"
        floor    = (fromIntegral :: Int -> Word16) . (floor :: Double -> Int)
    "ceiling/Double->Word16"
        ceiling  = (fromIntegral :: Int -> Word16) . (ceiling :: Double -> Int)
    "round/Double->Word16"
        round    = (fromIntegral :: Int -> Word16) . (round  :: Double -> Int)
      #-}

    ------------------------------------------------------------------------
    -- type Word32
    ------------------------------------------------------------------------

    -- Word32 is represented in the same way as Word.
    #if WORD_SIZE_IN_BITS > 32
    -- Operations may assume and must ensure that it holds only values
    -- from its logical range.

    -- We can use rewrite rules for the RealFrac methods

    {-# RULES
    "properFraction/Float->(Word32,Float)"
        properFraction = \x ->
                          case properFraction x of {
                            (n, y) -> ((fromIntegral :: Int -> Word32) n, y :: Float) }
    "truncate/Float->Word32"
        truncate = (fromIntegral :: Int -> Word32) . (truncate :: Float -> Int)
    "floor/Float->Word32"
        floor    = (fromIntegral :: Int -> Word32) . (floor :: Float -> Int)
    "ceiling/Float->Word32"
        ceiling  = (fromIntegral :: Int -> Word32) . (ceiling :: Float -> Int)
    "round/Float->Word32"
        round    = (fromIntegral :: Int -> Word32) . (round  :: Float -> Int)
      #-}

    {-# RULES
    "properFraction/Double->(Word32,Double)"
        properFraction = \x ->
                          case properFraction x of {
                            (n, y) -> ((fromIntegral :: Int -> Word32) n, y :: Double) }
    "truncate/Double->Word32"
        truncate = (fromIntegral :: Int -> Word32) . (truncate :: Double -> Int)
    "floor/Double->Word32"
        floor    = (fromIntegral :: Int -> Word32) . (floor :: Double -> Int)
    "ceiling/Double->Word32"
        ceiling  = (fromIntegral :: Int -> Word32) . (ceiling :: Double -> Int)
    "round/Double->Word32"
        round    = (fromIntegral :: Int -> Word32) . (round  :: Double -> Int)
      #-}

    #endif

    data {-# CTYPE "HsWord32" #-} Word32 = W32# Word32#
    -- ^ 32-bit unsigned integer type

    -- See GHC.Classes#matching_overloaded_methods_in_rules
    -- | @since 2.01
    instance Eq Word32 where
        == :: Word32 -> Word32 -> Bool
    (==) = Word32 -> Word32 -> Bool
    eqWord32
        /= :: Word32 -> Word32 -> Bool
    (/=) = Word32 -> Word32 -> Bool
    neWord32

    eqWord32, neWord32 :: Word32 -> Word32 -> Bool
    eqWord32 :: Word32 -> Word32 -> Bool
    eqWord32 (W32# Word32#
    x) (W32# Word32#
    y) = Int# -> Bool
    isTrue# ((Word32# -> Word#
    word32ToWord# Word32#
    x) Word# -> Word# -> Int#
    `eqWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y))
    neWord32 :: Word32 -> Word32 -> Bool
    neWord32 (W32# Word32#
    x) (W32# Word32#
    y) = Int# -> Bool
    isTrue# ((Word32# -> Word#
    word32ToWord# Word32#
    x) Word# -> Word# -> Int#
    `neWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y))
    {-# INLINE [1] eqWord32 #-}
    {-# INLINE [1] neWord32 #-}

    -- | @since 2.01
    instance Ord Word32 where
        < :: Word32 -> Word32 -> Bool
    (<)  = Word32 -> Word32 -> Bool
    ltWord32
        <= :: Word32 -> Word32 -> Bool
    (<=) = Word32 -> Word32 -> Bool
    leWord32
        >= :: Word32 -> Word32 -> Bool
    (>=) = Word32 -> Word32 -> Bool
    geWord32
        > :: Word32 -> Word32 -> Bool
    (>)  = Word32 -> Word32 -> Bool
    gtWord32

    {-# INLINE [1] gtWord32 #-}
    {-# INLINE [1] geWord32 #-}
    {-# INLINE [1] ltWord32 #-}
    {-# INLINE [1] leWord32 #-}
    gtWord32, geWord32, ltWord32, leWord32 :: Word32 -> Word32 -> Bool
    (W32# Word32#
    x) gtWord32 :: Word32 -> Word32 -> Bool
    `gtWord32` (W32# Word32#
    y) = Int# -> Bool
    isTrue# (Word32#
    x Word32# -> Word32# -> Int#
    `gtWord32#` Word32#
    y)
    (W32# Word32#
    x) geWord32 :: Word32 -> Word32 -> Bool
    `geWord32` (W32# Word32#
    y) = Int# -> Bool
    isTrue# (Word32#
    x Word32# -> Word32# -> Int#
    `geWord32#` Word32#
    y)
    (W32# Word32#
    x) ltWord32 :: Word32 -> Word32 -> Bool
    `ltWord32` (W32# Word32#
    y) = Int# -> Bool
    isTrue# (Word32#
    x Word32# -> Word32# -> Int#
    `ltWord32#` Word32#
    y)
    (W32# Word32#
    x) leWord32 :: Word32 -> Word32 -> Bool
    `leWord32` (W32# Word32#
    y) = Int# -> Bool
    isTrue# (Word32#
    x Word32# -> Word32# -> Int#
    `leWord32#` Word32#
    y)

    -- | @since 2.01
    instance Num Word32 where
        (W32# Word32#
    x#) + :: Word32 -> Word32 -> Word32
    + (W32# Word32#
    y#)  = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `plusWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
        (W32# Word32#
    x#) - :: Word32 -> Word32 -> Word32
    - (W32# Word32#
    y#)  = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `minusWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
        (W32# Word32#
    x#) * :: Word32 -> Word32 -> Word32
    * (W32# Word32#
    y#)  = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `timesWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
        negate :: Word32 -> Word32
    negate (W32# Word32#
    x#)       = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# (Int# -> Word#
    int2Word# (Int# -> Int#
    negateInt# (Word# -> Int#
    word2Int# (Word32# -> Word#
    word32ToWord# Word32#
    x#)))))
        abs :: Word32 -> Word32
    abs Word32
    x                  = Word32
    x
        signum :: Word32 -> Word32
    signum Word32
    0               = Word32
    0
        signum Word32
    _               = Word32
    1
        fromInteger :: Integer -> Word32
    fromInteger Integer
    i          = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# (Integer -> Word#
    integerToWord# Integer
    i))

    -- | @since 2.01
    instance Enum Word32 where
        succ :: Word32 -> Word32
    succ Word32
    x
            | Word32
    x forall a. Eq a => a -> a -> Bool
    /= forall a. Bounded a => a
    maxBound = Word32
    x forall a. Num a => a -> a -> a
    + Word32
    1
            | Bool
    otherwise     = forall a. String -> a
    succError String
    "Word32"
        pred :: Word32 -> Word32
    pred Word32
    x
            | Word32
    x forall a. Eq a => a -> a -> Bool
    /= forall a. Bounded a => a
    minBound = Word32
    x forall a. Num a => a -> a -> a
    - Word32
    1
            | Bool
    otherwise     = forall a. String -> a
    predError String
    "Word32"
        toEnum :: Int -> Word32
    toEnum i :: Int
    i@(I# Int#
    i#)
            | Int
    i forall a. Ord a => a -> a -> Bool
    >= Int
    0
    #if WORD_SIZE_IN_BITS > 32
              Bool -> Bool -> Bool
    && Int
    i forall a. Ord a => a -> a -> Bool
    <= forall a b. (Integral a, Num b) => a -> b
    fromIntegral (forall a. Bounded a => a
    maxBound::Word32)
    #endif
                            = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# (Int# -> Word#
    int2Word# Int#
    i#))
            | Bool
    otherwise     = forall a b. Show a => String -> Int -> (a, a) -> b
    toEnumError String
    "Word32" Int
    i (forall a. Bounded a => a
    minBound::Word32, forall a. Bounded a => a
    maxBound::Word32)
    #if WORD_SIZE_IN_BITS == 32
        fromEnum x@(W32# x#)
            | x <= fromIntegral (maxBound::Int)
                            = I# (word2Int# (word32ToWord# x#))
            | otherwise     = fromEnumError "Word32" x
        enumFrom            = integralEnumFrom
        enumFromThen        = integralEnumFromThen
        enumFromTo          = integralEnumFromTo
        enumFromThenTo      = integralEnumFromThenTo
    #else
        fromEnum :: Word32 -> Int
    fromEnum (W32# Word32#
    x#)  = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word32# -> Word#
    word32ToWord# Word32#
    x#))
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFrom #-}
        enumFrom :: Word32 -> [Word32]
    enumFrom            = forall a. (Enum a, Bounded a) => a -> [a]
    boundedEnumFrom
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFromThen #-}
        enumFromThen :: Word32 -> Word32 -> [Word32]
    enumFromThen        = forall a. (Enum a, Bounded a) => a -> a -> [a]
    boundedEnumFromThen
    #endif

    -- | @since 2.01
    instance Integral Word32 where
        quot :: Word32 -> Word32 -> Word32
    quot    (W32# Word32#
    x#) y :: Word32
    y@(W32# Word32#
    y#)
            | Word32
    y forall a. Eq a => a -> a -> Bool
    /= Word32
    0                    = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `quotWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        rem :: Word32 -> Word32 -> Word32
    rem     (W32# Word32#
    x#) y :: Word32
    y@(W32# Word32#
    y#)
            | Word32
    y forall a. Eq a => a -> a -> Bool
    /= Word32
    0                    = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `remWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        div :: Word32 -> Word32 -> Word32
    div     (W32# Word32#
    x#) y :: Word32
    y@(W32# Word32#
    y#)
            | Word32
    y forall a. Eq a => a -> a -> Bool
    /= Word32
    0                    = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `quotWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        mod :: Word32 -> Word32 -> Word32
    mod     (W32# Word32#
    x#) y :: Word32
    y@(W32# Word32#
    y#)
            | Word32
    y forall a. Eq a => a -> a -> Bool
    /= Word32
    0                    = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `remWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        quotRem :: Word32 -> Word32 -> (Word32, Word32)
    quotRem (W32# Word32#
    x#) y :: Word32
    y@(W32# Word32#
    y#)
            | Word32
    y forall a. Eq a => a -> a -> Bool
    /= Word32
    0                  = case (Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> (# Word#, Word# #)
    `quotRemWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#) of
                                        (# Word#
    q, Word#
    r #) ->
                                            (Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# Word#
    q), Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# Word#
    r))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        divMod :: Word32 -> Word32 -> (Word32, Word32)
    divMod  (W32# Word32#
    x#) y :: Word32
    y@(W32# Word32#
    y#)
            | Word32
    y forall a. Eq a => a -> a -> Bool
    /= Word32
    0                    = (Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `quotWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
                                          ,Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `remWord#` (Word32# -> Word#
    word32ToWord# Word32#
    y#))))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        toInteger :: Word32 -> Integer
    toInteger (W32# Word32#
    x#)             = Word# -> Integer
    integerFromWord# (Word32# -> Word#
    word32ToWord# Word32#
    x#)

    -- | @since 2.01
    instance Bits Word32 where
        {-# INLINE shift #-}
        {-# INLINE bit #-}
        {-# INLINE testBit #-}
        {-# INLINE popCount #-}

        (W32# Word32#
    x#) .&. :: Word32 -> Word32 -> Word32
    .&.   (W32# Word32#
    y#)  = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `and#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
        (W32# Word32#
    x#) .|. :: Word32 -> Word32 -> Word32
    .|.   (W32# Word32#
    y#)  = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `or#`  (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
        (W32# Word32#
    x#) xor :: Word32 -> Word32 -> Word32
    `xor` (W32# Word32#
    y#)  = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Word# -> Word#
    `xor#` (Word32# -> Word#
    word32ToWord# Word32#
    y#)))
        complement :: Word32 -> Word32
    complement (W32# Word32#
    x#)       = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# (Word# -> Word#
    not# (Word32# -> Word#
    word32ToWord# Word32#
    x#)))
        (W32# Word32#
    x#) shift :: Word32 -> Int -> Word32
    `shift` (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#)  = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Int# -> Word#
    `shiftL#` Int#
    i#))
            | Bool
    otherwise            = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Int# -> Word#
    `shiftRL#` Int# -> Int#
    negateInt# Int#
    i#))
        (W32# Word32#
    x#) shiftL :: Word32 -> Int -> Word32
    `shiftL`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#)  = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Int# -> Word#
    `shiftL#` Int#
    i#))
            | Bool
    otherwise            = forall a. a
    overflowError
        (W32# Word32#
    x#) unsafeShiftL :: Word32 -> Int -> Word32
    `unsafeShiftL` (I# Int#
    i#) =
            Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftL#` Int#
    i#))
        (W32# Word32#
    x#) shiftR :: Word32 -> Int -> Word32
    `shiftR`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#)  = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Int# -> Word#
    `shiftRL#` Int#
    i#))
            | Bool
    otherwise            = forall a. a
    overflowError
        (W32# Word32#
    x#) unsafeShiftR :: Word32 -> Int -> Word32
    `unsafeShiftR` (I# Int#
    i#) = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftRL#` Int#
    i#))
        (W32# Word32#
    x#) rotate :: Word32 -> Int -> Word32
    `rotate`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i'# Int# -> Int# -> Int#
    ==# Int#
    0#) = Word32# -> Word32
    W32# Word32#
    x#
            | Bool
    otherwise   = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# (((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftL#` Int#
    i'#) Word# -> Word# -> Word#
    `or#`
                                                ((Word32# -> Word#
    word32ToWord# Word32#
    x#) Word# -> Int# -> Word#
    `uncheckedShiftRL#` (Int#
    32# Int# -> Int# -> Int#
    -# Int#
    i'#))))
            where
            !i'# :: Int#
    i'# = Word# -> Int#
    word2Int# (Int# -> Word#
    int2Word# Int#
    i# Word# -> Word# -> Word#
    `and#` Word#
    31##)
        bitSizeMaybe :: Word32 -> Maybe Int
    bitSizeMaybe Word32
    i            = forall a. a -> Maybe a
    Just (forall b. FiniteBits b => b -> Int
    finiteBitSize Word32
    i)
        bitSize :: Word32 -> Int
    bitSize Word32
    i                 = forall b. FiniteBits b => b -> Int
    finiteBitSize Word32
    i
        isSigned :: Word32 -> Bool
    isSigned Word32
    _                = Bool
    False
        popCount :: Word32 -> Int
    popCount (W32# Word32#
    x#)        = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    popCnt32# (Word32# -> Word#
    word32ToWord# Word32#
    x#)))
        bit :: Int -> Word32
    bit                       = forall a. (Bits a, Num a) => Int -> a
    bitDefault
        testBit :: Word32 -> Int -> Bool
    testBit                   = forall a. (Bits a, Num a) => a -> Int -> Bool
    testBitDefault

    -- | @since 4.6.0.0
    instance FiniteBits Word32 where
        {-# INLINE countLeadingZeros #-}
        {-# INLINE countTrailingZeros #-}
        finiteBitSize :: Word32 -> Int
    finiteBitSize Word32
    _ = Int
    32
        countLeadingZeros :: Word32 -> Int
    countLeadingZeros  (W32# Word32#
    x#) = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    clz32# (Word32# -> Word#
    word32ToWord# Word32#
    x#)))
        countTrailingZeros :: Word32 -> Int
    countTrailingZeros (W32# Word32#
    x#) = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    ctz32# (Word32# -> Word#
    word32ToWord# Word32#
    x#)))

    -- | @since 2.01
    instance Show Word32 where
    #if WORD_SIZE_IN_BITS < 33
        showsPrec p x = showsPrec p (toInteger x)
    #else
        showsPrec :: Int -> Word32 -> ShowS
    showsPrec Int
    p Word32
    x = forall a. Show a => Int -> a -> ShowS
    showsPrec Int
    p (forall a b. (Integral a, Num b) => a -> b
    fromIntegral Word32
    x :: Int)
    #endif

    -- | @since 2.01
    instance Real Word32 where
        toRational :: Word32 -> Rational
    toRational Word32
    x = forall a. Integral a => a -> Integer
    toInteger Word32
    x forall a. Integral a => a -> a -> Ratio a
    % Integer
    1

    -- | @since 2.01
    instance Bounded Word32 where
        minBound :: Word32
    minBound = Word32
    0
        maxBound :: Word32
    maxBound = Word32
    0xFFFFFFFF

    -- | @since 2.01
    instance Ix Word32 where
        range :: (Word32, Word32) -> [Word32]
    range (Word32
    m,Word32
    n)         = [Word32
    m..Word32
    n]
        unsafeIndex :: (Word32, Word32) -> Word32 -> Int
    unsafeIndex (Word32
    m,Word32
    _) Word32
    i = forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Word32
    i forall a. Num a => a -> a -> a
    - Word32
    m)
        inRange :: (Word32, Word32) -> Word32 -> Bool
    inRange (Word32
    m,Word32
    n) Word32
    i     = Word32
    m forall a. Ord a => a -> a -> Bool
    <= Word32
    i Bool -> Bool -> Bool
    && Word32
    i forall a. Ord a => a -> a -> Bool
    <= Word32
    n

    -- | Reverse order of bytes in 'Word32'.
    --
    -- @since 4.7.0.0
    byteSwap32 :: Word32 -> Word32
    byteSwap32 :: Word32 -> Word32
    byteSwap32 (W32# Word32#
    w#) = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# (Word# -> Word#
    byteSwap32# (Word32# -> Word#
    word32ToWord# Word32#
    w#)))

    ------------------------------------------------------------------------
    -- type Word64
    ------------------------------------------------------------------------

    #if WORD_SIZE_IN_BITS < 64

    data {-# CTYPE "HsWord64" #-} Word64 = W64# Word64#
    -- ^ 64-bit unsigned integer type

    -- See GHC.Classes#matching_overloaded_methods_in_rules
    -- | @since 2.01
    instance Eq Word64 where
        (==) = eqWord64
        (/=) = neWord64

    eqWord64, neWord64 :: Word64 -> Word64 -> Bool
    eqWord64 (W64# x) (W64# y) = isTrue# (x `eqWord64#` y)
    neWord64 (W64# x) (W64# y) = isTrue# (x `neWord64#` y)
    {-# INLINE [1] eqWord64 #-}
    {-# INLINE [1] neWord64 #-}

    -- | @since 2.01
    instance Ord Word64 where
        (<)  = ltWord64
        (<=) = leWord64
        (>=) = geWord64
        (>)  = gtWord64

    {-# INLINE [1] gtWord64 #-}
    {-# INLINE [1] geWord64 #-}
    {-# INLINE [1] ltWord64 #-}
    {-# INLINE [1] leWord64 #-}
    gtWord64, geWord64, ltWord64, leWord64 :: Word64 -> Word64 -> Bool
    (W64# x) `gtWord64` (W64# y) = isTrue# (x `gtWord64#` y)
    (W64# x) `geWord64` (W64# y) = isTrue# (x `geWord64#` y)
    (W64# x) `ltWord64` (W64# y) = isTrue# (x `ltWord64#` y)
    (W64# x) `leWord64` (W64# y) = isTrue# (x `leWord64#` y)

    -- | @since 2.01
    instance Num Word64 where
        (W64# x#) + (W64# y#)  = W64# (int64ToWord64# (word64ToInt64# x# `plusInt64#` word64ToInt64# y#))
        (W64# x#) - (W64# y#)  = W64# (int64ToWord64# (word64ToInt64# x# `subInt64#` word64ToInt64# y#))
        (W64# x#) * (W64# y#)  = W64# (int64ToWord64# (word64ToInt64# x# `timesInt64#` word64ToInt64# y#))
        negate (W64# x#)       = W64# (int64ToWord64# (negateInt64# (word64ToInt64# x#)))
        abs x                  = x
        signum 0               = 0
        signum _               = 1
        fromInteger i          = W64# (integerToWord64# i)

    -- | @since 2.01
    instance Enum Word64 where
        succ x
            | x /= maxBound = x + 1
            | otherwise     = succError "Word64"
        pred x
            | x /= minBound = x - 1
            | otherwise     = predError "Word64"
        toEnum i@(I# i#)
            | i >= 0        = W64# (wordToWord64# (int2Word# i#))
            | otherwise     = toEnumError "Word64" i (minBound::Word64, maxBound::Word64)
        fromEnum x@(W64# x#)
            | x <= fromIntegral (maxBound::Int)
                            = I# (word2Int# (word64ToWord# x#))
            | otherwise     = fromEnumError "Word64" x
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFrom #-}
        enumFrom            = integralEnumFrom
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFromThen #-}
        enumFromThen        = integralEnumFromThen
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFromTo #-}
        enumFromTo          = integralEnumFromTo
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFromThenTo #-}
        enumFromThenTo      = integralEnumFromThenTo

    -- | @since 2.01
    instance Integral Word64 where
        quot    (W64# x#) y@(W64# y#)
            | y /= 0                    = W64# (x# `quotWord64#` y#)
            | otherwise                 = divZeroError
        rem     (W64# x#) y@(W64# y#)
            | y /= 0                    = W64# (x# `remWord64#` y#)
            | otherwise                 = divZeroError
        div     (W64# x#) y@(W64# y#)
            | y /= 0                    = W64# (x# `quotWord64#` y#)
            | otherwise                 = divZeroError
        mod     (W64# x#) y@(W64# y#)
            | y /= 0                    = W64# (x# `remWord64#` y#)
            | otherwise                 = divZeroError
        quotRem (W64# x#) y@(W64# y#)
            | y /= 0                    = (W64# (x# `quotWord64#` y#), W64# (x# `remWord64#` y#))
            | otherwise                 = divZeroError
        divMod  (W64# x#) y@(W64# y#)
            | y /= 0                    = (W64# (x# `quotWord64#` y#), W64# (x# `remWord64#` y#))
            | otherwise                 = divZeroError
        toInteger (W64# x#)             = integerFromWord64# x#

    -- | @since 2.01
    instance Bits Word64 where
        {-# INLINE shift #-}
        {-# INLINE bit #-}
        {-# INLINE testBit #-}
        {-# INLINE popCount #-}

        (W64# x#) .&.   (W64# y#)  = W64# (x# `and64#` y#)
        (W64# x#) .|.   (W64# y#)  = W64# (x# `or64#`  y#)
        (W64# x#) `xor` (W64# y#)  = W64# (x# `xor64#` y#)
        complement (W64# x#)       = W64# (not64# x#)
        (W64# x#) `shift` (I# i#)
            | isTrue# (i# >=# 0#)  = W64# (x# `shiftL64#` i#)
            | otherwise            = W64# (x# `shiftRL64#` negateInt# i#)
        (W64# x#) `shiftL`       (I# i#)
            | isTrue# (i# >=# 0#)  = W64# (x# `shiftL64#` i#)
            | otherwise            = overflowError
        (W64# x#) `unsafeShiftL` (I# i#) = W64# (x# `uncheckedShiftL64#` i#)
        (W64# x#) `shiftR`       (I# i#)
            | isTrue# (i# >=# 0#)  = W64# (x# `shiftRL64#` i#)
            | otherwise            = overflowError
        (W64# x#) `unsafeShiftR` (I# i#) = W64# (x# `uncheckedShiftRL64#` i#)
        (W64# x#) `rotate` (I# i#)
            | isTrue# (i'# ==# 0#) = W64# x#
            | otherwise            = W64# ((x# `uncheckedShiftL64#` i'#) `or64#`
                                           (x# `uncheckedShiftRL64#` (64# -# i'#)))
            where
            !i'# = word2Int# (int2Word# i# `and#` 63##)
        bitSizeMaybe i            = Just (finiteBitSize i)
        bitSize i                 = finiteBitSize i
        isSigned _                = False
        popCount (W64# x#)        = I# (word2Int# (popCnt64# x#))
        bit                       = bitDefault
        testBit                   = testBitDefault

    -- give the 64-bit shift operations the same treatment as the 32-bit
    -- ones (see GHC.Base), namely we wrap them in tests to catch the
    -- cases when we're shifting more than 64 bits to avoid unspecified
    -- behaviour in the C shift operations.

    shiftL64#, shiftRL64# :: Word64# -> Int# -> Word64#

    a `shiftL64#` b  | isTrue# (b >=# 64#) = wordToWord64# 0##
                     | otherwise           = a `uncheckedShiftL64#` b

    a `shiftRL64#` b | isTrue# (b >=# 64#) = wordToWord64# 0##
                     | otherwise           = a `uncheckedShiftRL64#` b

    #else

    -- Word64 is represented in the same way as Word.
    -- Operations may assume and must ensure that it holds only values
    -- from its logical range.

    data {-# CTYPE "HsWord64" #-} Word64 = W64# Word#
    -- ^ 64-bit unsigned integer type

    -- See GHC.Classes#matching_overloaded_methods_in_rules
    -- | @since 2.01
    instance Eq Word64 where
        == :: Word64 -> Word64 -> Bool
    (==) = Word64 -> Word64 -> Bool
    eqWord64
        /= :: Word64 -> Word64 -> Bool
    (/=) = Word64 -> Word64 -> Bool
    neWord64

    eqWord64, neWord64 :: Word64 -> Word64 -> Bool
    eqWord64 :: Word64 -> Word64 -> Bool
    eqWord64 (W64# Word#
    x) (W64# Word#
    y) = Int# -> Bool
    isTrue# (Word#
    x Word# -> Word# -> Int#
    `eqWord#` Word#
    y)
    neWord64 :: Word64 -> Word64 -> Bool
    neWord64 (W64# Word#
    x) (W64# Word#
    y) = Int# -> Bool
    isTrue# (Word#
    x Word# -> Word# -> Int#
    `neWord#` Word#
    y)
    {-# INLINE [1] eqWord64 #-}
    {-# INLINE [1] neWord64 #-}

    -- | @since 2.01
    instance Ord Word64 where
        < :: Word64 -> Word64 -> Bool
    (<)  = Word64 -> Word64 -> Bool
    ltWord64
        <= :: Word64 -> Word64 -> Bool
    (<=) = Word64 -> Word64 -> Bool
    leWord64
        >= :: Word64 -> Word64 -> Bool
    (>=) = Word64 -> Word64 -> Bool
    geWord64
        > :: Word64 -> Word64 -> Bool
    (>)  = Word64 -> Word64 -> Bool
    gtWord64

    {-# INLINE [1] gtWord64 #-}
    {-# INLINE [1] geWord64 #-}
    {-# INLINE [1] ltWord64 #-}
    {-# INLINE [1] leWord64 #-}
    gtWord64, geWord64, ltWord64, leWord64 :: Word64 -> Word64 -> Bool
    (W64# Word#
    x) gtWord64 :: Word64 -> Word64 -> Bool
    `gtWord64` (W64# Word#
    y) = Int# -> Bool
    isTrue# (Word#
    x Word# -> Word# -> Int#
    `gtWord#` Word#
    y)
    (W64# Word#
    x) geWord64 :: Word64 -> Word64 -> Bool
    `geWord64` (W64# Word#
    y) = Int# -> Bool
    isTrue# (Word#
    x Word# -> Word# -> Int#
    `geWord#` Word#
    y)
    (W64# Word#
    x) ltWord64 :: Word64 -> Word64 -> Bool
    `ltWord64` (W64# Word#
    y) = Int# -> Bool
    isTrue# (Word#
    x Word# -> Word# -> Int#
    `ltWord#` Word#
    y)
    (W64# Word#
    x) leWord64 :: Word64 -> Word64 -> Bool
    `leWord64` (W64# Word#
    y) = Int# -> Bool
    isTrue# (Word#
    x Word# -> Word# -> Int#
    `leWord#` Word#
    y)

    -- | @since 2.01
    instance Num Word64 where
        (W64# Word#
    x#) + :: Word64 -> Word64 -> Word64
    + (W64# Word#
    y#)  = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `plusWord#` Word#
    y#)
        (W64# Word#
    x#) - :: Word64 -> Word64 -> Word64
    - (W64# Word#
    y#)  = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `minusWord#` Word#
    y#)
        (W64# Word#
    x#) * :: Word64 -> Word64 -> Word64
    * (W64# Word#
    y#)  = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `timesWord#` Word#
    y#)
        negate :: Word64 -> Word64
    negate (W64# Word#
    x#)       = Word# -> Word64
    W64# (Int# -> Word#
    int2Word# (Int# -> Int#
    negateInt# (Word# -> Int#
    word2Int# Word#
    x#)))
        abs :: Word64 -> Word64
    abs Word64
    x                  = Word64
    x
        signum :: Word64 -> Word64
    signum Word64
    0               = Word64
    0
        signum Word64
    _               = Word64
    1
        fromInteger :: Integer -> Word64
    fromInteger Integer
    i          = Word# -> Word64
    W64# (Integer -> Word#
    integerToWord# Integer
    i)

    -- | @since 2.01
    instance Enum Word64 where
        succ :: Word64 -> Word64
    succ Word64
    x
            | Word64
    x forall a. Eq a => a -> a -> Bool
    /= forall a. Bounded a => a
    maxBound = Word64
    x forall a. Num a => a -> a -> a
    + Word64
    1
            | Bool
    otherwise     = forall a. String -> a
    succError String
    "Word64"
        pred :: Word64 -> Word64
    pred Word64
    x
            | Word64
    x forall a. Eq a => a -> a -> Bool
    /= forall a. Bounded a => a
    minBound = Word64
    x forall a. Num a => a -> a -> a
    - Word64
    1
            | Bool
    otherwise     = forall a. String -> a
    predError String
    "Word64"
        toEnum :: Int -> Word64
    toEnum i :: Int
    i@(I# Int#
    i#)
            | Int
    i forall a. Ord a => a -> a -> Bool
    >= Int
    0        = Word# -> Word64
    W64# (Int# -> Word#
    int2Word# Int#
    i#)
            | Bool
    otherwise     = forall a b. Show a => String -> Int -> (a, a) -> b
    toEnumError String
    "Word64" Int
    i (forall a. Bounded a => a
    minBound::Word64, forall a. Bounded a => a
    maxBound::Word64)
        fromEnum :: Word64 -> Int
    fromEnum x :: Word64
    x@(W64# Word#
    x#)
            | Word64
    x forall a. Ord a => a -> a -> Bool
    <= forall a b. (Integral a, Num b) => a -> b
    fromIntegral (forall a. Bounded a => a
    maxBound::Int)
                            = Int# -> Int
    I# (Word# -> Int#
    word2Int# Word#
    x#)
            | Bool
    otherwise     = forall a b. Show a => String -> a -> b
    fromEnumError String
    "Word64" Word64
    x

    #if WORD_SIZE_IN_BITS < 64
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFrom #-}
        enumFrom            = integralEnumFrom
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFromThen #-}
        enumFromThen        = integralEnumFromThen
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFromTo #-}
        enumFromTo          = integralEnumFromTo
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINE enumFromThenTo #-}
        enumFromThenTo      = integralEnumFromThenTo
    #else
        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINABLE enumFrom #-}
        enumFrom :: Word64 -> [Word64]
    enumFrom Word64
    w
            = forall a b. (a -> b) -> [a] -> [b]
    map Word -> Word64
    wordToWord64
            forall a b. (a -> b) -> a -> b
    $ forall a. Enum a => a -> [a]
    enumFrom (Word64 -> Word
    word64ToWord Word64
    w)

        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINABLE enumFromThen #-}
        enumFromThen :: Word64 -> Word64 -> [Word64]
    enumFromThen Word64
    w Word64
    s
            = forall a b. (a -> b) -> [a] -> [b]
    map Word -> Word64
    wordToWord64
            forall a b. (a -> b) -> a -> b
    $ forall a. Enum a => a -> a -> [a]
    enumFromThen (Word64 -> Word
    word64ToWord Word64
    w) (Word64 -> Word
    word64ToWord Word64
    s)

        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINABLE enumFromTo #-}
        enumFromTo :: Word64 -> Word64 -> [Word64]
    enumFromTo Word64
    w1 Word64
    w2
            = forall a b. (a -> b) -> [a] -> [b]
    map Word -> Word64
    wordToWord64
            forall a b. (a -> b) -> a -> b
    $ forall a. Enum a => a -> a -> [a]
    enumFromTo (Word64 -> Word
    word64ToWord Word64
    w1) (Word64 -> Word
    word64ToWord Word64
    w2)

        -- See Note [Stable Unfolding for list producers] in GHC.Enum
        {-# INLINABLE enumFromThenTo #-}
        enumFromThenTo :: Word64 -> Word64 -> Word64 -> [Word64]
    enumFromThenTo Word64
    w1 Word64
    s Word64
    w2
            = forall a b. (a -> b) -> [a] -> [b]
    map Word -> Word64
    wordToWord64
            forall a b. (a -> b) -> a -> b
    $ forall a. Enum a => a -> a -> a -> [a]
    enumFromThenTo (Word64 -> Word
    word64ToWord Word64
    w1) (Word64 -> Word
    word64ToWord Word64
    s) (Word64 -> Word
    word64ToWord Word64
    w2)

    word64ToWord :: Word64 -> Word
    word64ToWord :: Word64 -> Word
    word64ToWord (W64# Word#
    w#) = (Word# -> Word
    W# Word#
    w#)

    wordToWord64 :: Word -> Word64
    wordToWord64 :: Word -> Word64
    wordToWord64 (W# Word#
    w#) = (Word# -> Word64
    W64# Word#
    w#)
    #endif

    -- | @since 2.01
    instance Integral Word64 where
        quot :: Word64 -> Word64 -> Word64
    quot    (W64# Word#
    x#) y :: Word64
    y@(W64# Word#
    y#)
            | Word64
    y forall a. Eq a => a -> a -> Bool
    /= Word64
    0                    = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `quotWord#` Word#
    y#)
            | Bool
    otherwise                 = forall a. a
    divZeroError
        rem :: Word64 -> Word64 -> Word64
    rem     (W64# Word#
    x#) y :: Word64
    y@(W64# Word#
    y#)
            | Word64
    y forall a. Eq a => a -> a -> Bool
    /= Word64
    0                    = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `remWord#` Word#
    y#)
            | Bool
    otherwise                 = forall a. a
    divZeroError
        div :: Word64 -> Word64 -> Word64
    div     (W64# Word#
    x#) y :: Word64
    y@(W64# Word#
    y#)
            | Word64
    y forall a. Eq a => a -> a -> Bool
    /= Word64
    0                    = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `quotWord#` Word#
    y#)
            | Bool
    otherwise                 = forall a. a
    divZeroError
        mod :: Word64 -> Word64 -> Word64
    mod     (W64# Word#
    x#) y :: Word64
    y@(W64# Word#
    y#)
            | Word64
    y forall a. Eq a => a -> a -> Bool
    /= Word64
    0                    = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `remWord#` Word#
    y#)
            | Bool
    otherwise                 = forall a. a
    divZeroError
        quotRem :: Word64 -> Word64 -> (Word64, Word64)
    quotRem (W64# Word#
    x#) y :: Word64
    y@(W64# Word#
    y#)
            | Word64
    y forall a. Eq a => a -> a -> Bool
    /= Word64
    0                  = case Word#
    x# Word# -> Word# -> (# Word#, Word# #)
    `quotRemWord#` Word#
    y# of
                                        (# Word#
    q, Word#
    r #) ->
                                            (Word# -> Word64
    W64# Word#
    q, Word# -> Word64
    W64# Word#
    r)
            | Bool
    otherwise                 = forall a. a
    divZeroError
        divMod :: Word64 -> Word64 -> (Word64, Word64)
    divMod  (W64# Word#
    x#) y :: Word64
    y@(W64# Word#
    y#)
            | Word64
    y forall a. Eq a => a -> a -> Bool
    /= Word64
    0                    = (Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `quotWord#` Word#
    y#), Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `remWord#` Word#
    y#))
            | Bool
    otherwise                 = forall a. a
    divZeroError
        toInteger :: Word64 -> Integer
    toInteger (W64# Word#
    x#)             = Word# -> Integer
    integerFromWord# Word#
    x#

    -- | @since 2.01
    instance Bits Word64 where
        {-# INLINE shift #-}
        {-# INLINE bit #-}
        {-# INLINE testBit #-}
        {-# INLINE popCount #-}

        (W64# Word#
    x#) .&. :: Word64 -> Word64 -> Word64
    .&.   (W64# Word#
    y#)  = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `and#` Word#
    y#)
        (W64# Word#
    x#) .|. :: Word64 -> Word64 -> Word64
    .|.   (W64# Word#
    y#)  = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `or#`  Word#
    y#)
        (W64# Word#
    x#) xor :: Word64 -> Word64 -> Word64
    `xor` (W64# Word#
    y#)  = Word# -> Word64
    W64# (Word#
    x# Word# -> Word# -> Word#
    `xor#` Word#
    y#)
        complement :: Word64 -> Word64
    complement (W64# Word#
    x#)       = Word# -> Word64
    W64# (Word# -> Word#
    not# Word#
    x#)
        (W64# Word#
    x#) shift :: Word64 -> Int -> Word64
    `shift` (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#)  = Word# -> Word64
    W64# (Word#
    x# Word# -> Int# -> Word#
    `shiftL#` Int#
    i#)
            | Bool
    otherwise            = Word# -> Word64
    W64# (Word#
    x# Word# -> Int# -> Word#
    `shiftRL#` Int# -> Int#
    negateInt# Int#
    i#)
        (W64# Word#
    x#) shiftL :: Word64 -> Int -> Word64
    `shiftL`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#)  = Word# -> Word64
    W64# (Word#
    x# Word# -> Int# -> Word#
    `shiftL#` Int#
    i#)
            | Bool
    otherwise            = forall a. a
    overflowError
        (W64# Word#
    x#) unsafeShiftL :: Word64 -> Int -> Word64
    `unsafeShiftL` (I# Int#
    i#) = Word# -> Word64
    W64# (Word#
    x# Word# -> Int# -> Word#
    `uncheckedShiftL#` Int#
    i#)
        (W64# Word#
    x#) shiftR :: Word64 -> Int -> Word64
    `shiftR`       (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i# Int# -> Int# -> Int#
    >=# Int#
    0#)  = Word# -> Word64
    W64# (Word#
    x# Word# -> Int# -> Word#
    `shiftRL#` Int#
    i#)
            | Bool
    otherwise            = forall a. a
    overflowError
        (W64# Word#
    x#) unsafeShiftR :: Word64 -> Int -> Word64
    `unsafeShiftR` (I# Int#
    i#) = Word# -> Word64
    W64# (Word#
    x# Word# -> Int# -> Word#
    `uncheckedShiftRL#` Int#
    i#)
        (W64# Word#
    x#) rotate :: Word64 -> Int -> Word64
    `rotate` (I# Int#
    i#)
            | Int# -> Bool
    isTrue# (Int#
    i'# Int# -> Int# -> Int#
    ==# Int#
    0#) = Word# -> Word64
    W64# Word#
    x#
            | Bool
    otherwise            = Word# -> Word64
    W64# ((Word#
    x# Word# -> Int# -> Word#
    `uncheckedShiftL#` Int#
    i'#) Word# -> Word# -> Word#
    `or#`
                                           (Word#
    x# Word# -> Int# -> Word#
    `uncheckedShiftRL#` (Int#
    64# Int# -> Int# -> Int#
    -# Int#
    i'#)))
            where
            !i'# :: Int#
    i'# = Word# -> Int#
    word2Int# (Int# -> Word#
    int2Word# Int#
    i# Word# -> Word# -> Word#
    `and#` Word#
    63##)
        bitSizeMaybe :: Word64 -> Maybe Int
    bitSizeMaybe Word64
    i            = forall a. a -> Maybe a
    Just (forall b. FiniteBits b => b -> Int
    finiteBitSize Word64
    i)
        bitSize :: Word64 -> Int
    bitSize Word64
    i                 = forall b. FiniteBits b => b -> Int
    finiteBitSize Word64
    i
        isSigned :: Word64 -> Bool
    isSigned Word64
    _                = Bool
    False
        popCount :: Word64 -> Int
    popCount (W64# Word#
    x#)        = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    popCnt64# Word#
    x#))
        bit :: Int -> Word64
    bit                       = forall a. (Bits a, Num a) => Int -> a
    bitDefault
        testBit :: Word64 -> Int -> Bool
    testBit                   = forall a. (Bits a, Num a) => a -> Int -> Bool
    testBitDefault

    uncheckedShiftL64# :: Word# -> Int# -> Word#
    uncheckedShiftL64# :: Word# -> Int# -> Word#
    uncheckedShiftL64#  = Word# -> Int# -> Word#
    uncheckedShiftL#

    uncheckedShiftRL64# :: Word# -> Int# -> Word#
    uncheckedShiftRL64# :: Word# -> Int# -> Word#
    uncheckedShiftRL64# = Word# -> Int# -> Word#
    uncheckedShiftRL#

    #endif

    -- | @since 4.6.0.0
    instance FiniteBits Word64 where
        {-# INLINE countLeadingZeros #-}
        {-# INLINE countTrailingZeros #-}
        finiteBitSize :: Word64 -> Int
    finiteBitSize Word64
    _ = Int
    64
        countLeadingZeros :: Word64 -> Int
    countLeadingZeros  (W64# Word#
    x#) = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    clz64# Word#
    x#))
        countTrailingZeros :: Word64 -> Int
    countTrailingZeros (W64# Word#
    x#) = Int# -> Int
    I# (Word# -> Int#
    word2Int# (Word# -> Word#
    ctz64# Word#
    x#))

    -- | @since 2.01
    instance Show Word64 where
        showsPrec :: Int -> Word64 -> ShowS
    showsPrec Int
    p Word64
    x = forall a. Show a => Int -> a -> ShowS
    showsPrec Int
    p (forall a. Integral a => a -> Integer
    toInteger Word64
    x)

    -- | @since 2.01
    instance Real Word64 where
        toRational :: Word64 -> Rational
    toRational Word64
    x = forall a. Integral a => a -> Integer
    toInteger Word64
    x forall a. Integral a => a -> a -> Ratio a
    % Integer
    1

    -- | @since 2.01
    instance Bounded Word64 where
        minBound :: Word64
    minBound = Word64
    0
        maxBound :: Word64
    maxBound = Word64
    0xFFFFFFFFFFFFFFFF

    -- | @since 2.01
    instance Ix Word64 where
        range :: (Word64, Word64) -> [Word64]
    range (Word64
    m,Word64
    n)         = [Word64
    m..Word64
    n]
        unsafeIndex :: (Word64, Word64) -> Word64 -> Int
    unsafeIndex (Word64
    m,Word64
    _) Word64
    i = forall a b. (Integral a, Num b) => a -> b
    fromIntegral (Word64
    i forall a. Num a => a -> a -> a
    - Word64
    m)
        inRange :: (Word64, Word64) -> Word64 -> Bool
    inRange (Word64
    m,Word64
    n) Word64
    i     = Word64
    m forall a. Ord a => a -> a -> Bool
    <= Word64
    i Bool -> Bool -> Bool
    && Word64
    i forall a. Ord a => a -> a -> Bool
    <= Word64
    n

    -- | Reverse order of bytes in 'Word64'.
    --
    -- @since 4.7.0.0
    #if WORD_SIZE_IN_BITS < 64
    byteSwap64 :: Word64 -> Word64
    byteSwap64 (W64# w#) = W64# (byteSwap64# w#)
    #else
    byteSwap64 :: Word64 -> Word64
    byteSwap64 :: Word64 -> Word64
    byteSwap64 (W64# Word#
    w#) = Word# -> Word64
    W64# (Word# -> Word#
    byteSwap# Word#
    w#)
    #endif

    -- | Reverse the order of the bits in a 'Word8'.
    --
    -- @since 4.14.0.0
    bitReverse8 :: Word8 -> Word8
    bitReverse8 :: Word8 -> Word8
    bitReverse8 (W8# Word8#
    w#) = Word8# -> Word8
    W8# (Word# -> Word8#
    wordToWord8# (Word# -> Word#
    bitReverse8# (Word8# -> Word#
    word8ToWord# Word8#
    w#)))

    -- | Reverse the order of the bits in a 'Word16'.
    --
    -- @since 4.14.0.0
    bitReverse16 :: Word16 -> Word16
    bitReverse16 :: Word16 -> Word16
    bitReverse16 (W16# Word16#
    w#) = Word16# -> Word16
    W16# (Word# -> Word16#
    wordToWord16# (Word# -> Word#
    bitReverse16# (Word16# -> Word#
    word16ToWord# Word16#
    w#)))

    -- | Reverse the order of the bits in a 'Word32'.
    --
    -- @since 4.14.0.0
    bitReverse32 :: Word32 -> Word32
    bitReverse32 :: Word32 -> Word32
    bitReverse32 (W32# Word32#
    w#) = Word32# -> Word32
    W32# (Word# -> Word32#
    wordToWord32# (Word# -> Word#
    bitReverse32# (Word32# -> Word#
    word32ToWord# Word32#
    w#)))

    -- | Reverse the order of the bits in a 'Word64'.
    --
    -- @since 4.14.0.0
    #if WORD_SIZE_IN_BITS < 64
    bitReverse64 :: Word64 -> Word64
    bitReverse64 (W64# w#) = W64# (bitReverse64# w#)
    #else
    bitReverse64 :: Word64 -> Word64
    bitReverse64 :: Word64 -> Word64
    bitReverse64 (W64# Word#
    w#) = Word# -> Word64
    W64# (Word# -> Word#
    bitReverse# Word#
    w#)
    #endif