Data.Word

base-4.10.1.0: Basic libraries

Copyright | (c) The University of Glasgow 2001
License | BSD-style (see the file libraries/base/LICENSE)
Maintainer | libraries@haskell.org
Stability | experimental
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Data.Word

Contents

- Unsigned integral types
- byte swapping
- Notes

Description

Unsigned integer types.

Synopsis

- data Word :: *
- data Word8
- data Word16
- data Word32
- data Word64
- byteSwap16 :: Word16 -> Word16
- byteSwap32 :: Word32 -> Word32
- byteSwap64 :: Word64 -> Word64

# Unsigned integral types

data Word :: * Source #

A `Word` is an unsigned integral type, with the same size as `Int`.

Instances

Bounded Word # | Since: 2.1
Methods minBound :: Word Source # maxBound :: Word Source #
Enum Word # | Since: 2.1
Methods succ :: Word -> Word Source # pred :: Word -> Word Source # toEnum :: Int -> Word Source # fromEnum :: Word -> Int Source # enumFrom :: Word -> [Word] Source # enumFromThen :: Word -> Word -> [Word] Source # enumFromTo :: Word -> Word -> [Word] Source # enumFromThenTo :: Word -> Word -> Word -> [Word] Source #
Eq Word |
Methods (==) :: Word -> Word -> Bool Source # (/=) :: Word -> Word -> Bool Source #
Integral Word # | Since: 2.1
Methods quot :: Word -> Word -> Word Source # rem :: Word -> Word -> Word Source # div :: Word -> Word -> Word Source # mod :: Word -> Word -> Word Source # quotRem :: Word -> Word -> (Word, Word) Source # divMod :: Word -> Word -> (Word, Word) Source # toInteger :: Word -> Integer Source #
Data Word # | Since: 4.0.0.0
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word -> c Word Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word Source # toConstr :: Word -> Constr Source # dataTypeOf :: Word -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Word) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word) Source # gmapT :: (forall b. Data b => b -> b) -> Word -> Word Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Word -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word -> m Word Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word -> m Word Source #
Num Word # | Since: 2.1
Methods (+) :: Word -> Word -> Word Source # (-) :: Word -> Word -> Word Source # (*) :: Word -> Word -> Word Source # negate :: Word -> Word Source # abs :: Word -> Word Source # signum :: Word -> Word Source # fromInteger :: Integer -> Word Source #
Ord Word |
Methods compare :: Word -> Word -> Ordering Source # (<) :: Word -> Word -> Bool Source # (<=) :: Word -> Word -> Bool Source # (>) :: Word -> Word -> Bool Source # (>=) :: Word -> Word -> Bool Source # max :: Word -> Word -> Word Source # min :: Word -> Word -> Word Source #
Read Word # | Since: 4.5.0.0
Methods readsPrec :: Int -> ReadS Word Source # readList :: ReadS [Word] Source # readPrec :: ReadPrec Word Source # readListPrec :: ReadPrec [Word] Source #
Real Word # | Since: 2.1
Methods toRational :: Word -> Rational Source #
Show Word # | Since: 2.1
Methods showsPrec :: Int -> Word -> ShowS Source # show :: Word -> String Source # showList :: [Word] -> ShowS Source #
Ix Word # | Since: 4.6.0.0
Methods range :: (Word, Word) -> [Word] Source # index :: (Word, Word) -> Word -> Int Source # unsafeIndex :: (Word, Word) -> Word -> Int inRange :: (Word, Word) -> Word -> Bool Source # rangeSize :: (Word, Word) -> Int Source # unsafeRangeSize :: (Word, Word) -> Int
FiniteBits Word # | Since: 4.6.0.0
Methods finiteBitSize :: Word -> Int Source # countLeadingZeros :: Word -> Int Source # countTrailingZeros :: Word -> Int Source #
Bits Word # | Since: 2.1
Methods (.&.) :: Word -> Word -> Word Source # (.|.) :: Word -> Word -> Word Source # xor :: Word -> Word -> Word Source # complement :: Word -> Word Source # shift :: Word -> Int -> Word Source # rotate :: Word -> Int -> Word Source # zeroBits :: Word Source # bit :: Int -> Word Source # setBit :: Word -> Int -> Word Source # clearBit :: Word -> Int -> Word Source # complementBit :: Word -> Int -> Word Source # testBit :: Word -> Int -> Bool Source # bitSizeMaybe :: Word -> Maybe Int Source # bitSize :: Word -> Int Source # isSigned :: Word -> Bool Source # shiftL :: Word -> Int -> Word Source # unsafeShiftL :: Word -> Int -> Word Source # shiftR :: Word -> Int -> Word Source # unsafeShiftR :: Word -> Int -> Word Source # rotateL :: Word -> Int -> Word Source # rotateR :: Word -> Int -> Word Source # popCount :: Word -> Int Source #
Storable Word # | Since: 2.1
Methods sizeOf :: Word -> Int Source # alignment :: Word -> Int Source # peekElemOff :: Ptr Word -> Int -> IO Word Source # pokeElemOff :: Ptr Word -> Int -> Word -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Word Source # pokeByteOff :: Ptr b -> Int -> Word -> IO () Source # peek :: Ptr Word -> IO Word Source # poke :: Ptr Word -> Word -> IO () Source #
PrintfArg Word # | Since: 2.1
Methods formatArg :: Word -> FieldFormatter Source # parseFormat :: Word -> ModifierParser Source #
Generic1 k (URec k Word) # |
Associated Types type Rep1 (URec k Word) (f :: URec k Word -> *) :: k -> * Source # Methods from1 :: f a -> Rep1 (URec k Word) f a Source # to1 :: Rep1 (URec k Word) f a -> f a Source #
Functor (URec * Word) # |
Methods fmap :: (a -> b) -> URec * Word a -> URec * Word b Source # (<$) :: a -> URec * Word b -> URec * Word a Source #
Foldable (URec * Word) # |
Methods fold :: Monoid m => URec * Word m -> m Source # foldMap :: Monoid m => (a -> m) -> URec * Word a -> m Source # foldr :: (a -> b -> b) -> b -> URec * Word a -> b Source # foldr' :: (a -> b -> b) -> b -> URec * Word a -> b Source # foldl :: (b -> a -> b) -> b -> URec * Word a -> b Source # foldl' :: (b -> a -> b) -> b -> URec * Word a -> b Source # foldr1 :: (a -> a -> a) -> URec * Word a -> a Source # foldl1 :: (a -> a -> a) -> URec * Word a -> a Source # toList :: URec * Word a -> [a] Source # null :: URec * Word a -> Bool Source # length :: URec * Word a -> Int Source # elem :: Eq a => a -> URec * Word a -> Bool Source # maximum :: Ord a => URec * Word a -> a Source # minimum :: Ord a => URec * Word a -> a Source # sum :: Num a => URec * Word a -> a Source # product :: Num a => URec * Word a -> a Source #
Traversable (URec * Word) # |
Methods traverse :: Applicative f => (a -> f b) -> URec * Word a -> f (URec * Word b) Source # sequenceA :: Applicative f => URec * Word (f a) -> f (URec * Word a) Source # mapM :: Monad m => (a -> m b) -> URec * Word a -> m (URec * Word b) Source # sequence :: Monad m => URec * Word (m a) -> m (URec * Word a) Source #
Eq (URec k Word p) # |
Methods (==) :: URec k Word p -> URec k Word p -> Bool Source # (/=) :: URec k Word p -> URec k Word p -> Bool Source #
Ord (URec k Word p) # |
Methods compare :: URec k Word p -> URec k Word p -> Ordering Source # (<) :: URec k Word p -> URec k Word p -> Bool Source # (<=) :: URec k Word p -> URec k Word p -> Bool Source # (>) :: URec k Word p -> URec k Word p -> Bool Source # (>=) :: URec k Word p -> URec k Word p -> Bool Source # max :: URec k Word p -> URec k Word p -> URec k Word p Source # min :: URec k Word p -> URec k Word p -> URec k Word p Source #
Show (URec k Word p) # |
Methods showsPrec :: Int -> URec k Word p -> ShowS Source # show :: URec k Word p -> String Source # showList :: [URec k Word p] -> ShowS Source #
Generic (URec k Word p) # |
Associated Types type Rep (URec k Word p) :: * -> * Source # Methods from :: URec k Word p -> Rep (URec k Word p) x Source # to :: Rep (URec k Word p) x -> URec k Word p Source #
data URec k Word # | Used for marking occurrences of `Word#` Since: 4.9.0.0
data URec k Word = UWord { uWord# :: Word# }
type Rep1 k (URec k Word) # |
type Rep1 k (URec k Word) = D1 k (MetaData "URec" "GHC.Generics" "base" False) (C1 k (MetaCons "UWord" PrefixI True) (S1 k (MetaSel (Just Symbol "uWord#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UWord k)))
type Rep (URec k Word p) # |
type Rep (URec k Word p) = D1 * (MetaData "URec" "GHC.Generics" "base" False) (C1 * (MetaCons "UWord" PrefixI True) (S1 * (MetaSel (Just Symbol "uWord#") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (UWord *)))

data Word8 Source #

8-bit unsigned integer type

Instances

Bounded Word8 # | Since: 2.1
Methods minBound :: Word8 Source # maxBound :: Word8 Source #
Enum Word8 # | Since: 2.1
Methods succ :: Word8 -> Word8 Source # pred :: Word8 -> Word8 Source # toEnum :: Int -> Word8 Source # fromEnum :: Word8 -> Int Source # enumFrom :: Word8 -> [Word8] Source # enumFromThen :: Word8 -> Word8 -> [Word8] Source # enumFromTo :: Word8 -> Word8 -> [Word8] Source # enumFromThenTo :: Word8 -> Word8 -> Word8 -> [Word8] Source #
Eq Word8 # | Since: 2.1
Methods (==) :: Word8 -> Word8 -> Bool Source # (/=) :: Word8 -> Word8 -> Bool Source #
Integral Word8 # | Since: 2.1
Methods quot :: Word8 -> Word8 -> Word8 Source # rem :: Word8 -> Word8 -> Word8 Source # div :: Word8 -> Word8 -> Word8 Source # mod :: Word8 -> Word8 -> Word8 Source # quotRem :: Word8 -> Word8 -> (Word8, Word8) Source # divMod :: Word8 -> Word8 -> (Word8, Word8) Source # toInteger :: Word8 -> Integer Source #
Data Word8 # | Since: 4.0.0.0
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word8 -> c Word8 Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word8 Source # toConstr :: Word8 -> Constr Source # dataTypeOf :: Word8 -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Word8) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word8) Source # gmapT :: (forall b. Data b => b -> b) -> Word8 -> Word8 Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word8 -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Word8 -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word8 -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word8 -> m Word8 Source #
Num Word8 # | Since: 2.1
Methods (+) :: Word8 -> Word8 -> Word8 Source # (-) :: Word8 -> Word8 -> Word8 Source # (*) :: Word8 -> Word8 -> Word8 Source # negate :: Word8 -> Word8 Source # abs :: Word8 -> Word8 Source # signum :: Word8 -> Word8 Source # fromInteger :: Integer -> Word8 Source #
Ord Word8 # | Since: 2.1
Methods compare :: Word8 -> Word8 -> Ordering Source # (<) :: Word8 -> Word8 -> Bool Source # (<=) :: Word8 -> Word8 -> Bool Source # (>) :: Word8 -> Word8 -> Bool Source # (>=) :: Word8 -> Word8 -> Bool Source # max :: Word8 -> Word8 -> Word8 Source # min :: Word8 -> Word8 -> Word8 Source #
Read Word8 # | Since: 2.1
Methods readsPrec :: Int -> ReadS Word8 Source # readList :: ReadS [Word8] Source # readPrec :: ReadPrec Word8 Source # readListPrec :: ReadPrec [Word8] Source #
Real Word8 # | Since: 2.1
Methods toRational :: Word8 -> Rational Source #
Show Word8 # | Since: 2.1
Methods showsPrec :: Int -> Word8 -> ShowS Source # show :: Word8 -> String Source # showList :: [Word8] -> ShowS Source #
Ix Word8 # | Since: 2.1
Methods range :: (Word8, Word8) -> [Word8] Source # index :: (Word8, Word8) -> Word8 -> Int Source # unsafeIndex :: (Word8, Word8) -> Word8 -> Int inRange :: (Word8, Word8) -> Word8 -> Bool Source # rangeSize :: (Word8, Word8) -> Int Source # unsafeRangeSize :: (Word8, Word8) -> Int
FiniteBits Word8 # | Since: 4.6.0.0
Methods finiteBitSize :: Word8 -> Int Source # countLeadingZeros :: Word8 -> Int Source # countTrailingZeros :: Word8 -> Int Source #
Bits Word8 # | Since: 2.1
Methods (.&.) :: Word8 -> Word8 -> Word8 Source # (.|.) :: Word8 -> Word8 -> Word8 Source # xor :: Word8 -> Word8 -> Word8 Source # complement :: Word8 -> Word8 Source # shift :: Word8 -> Int -> Word8 Source # rotate :: Word8 -> Int -> Word8 Source # zeroBits :: Word8 Source # bit :: Int -> Word8 Source # setBit :: Word8 -> Int -> Word8 Source # clearBit :: Word8 -> Int -> Word8 Source # complementBit :: Word8 -> Int -> Word8 Source # testBit :: Word8 -> Int -> Bool Source # bitSizeMaybe :: Word8 -> Maybe Int Source # bitSize :: Word8 -> Int Source # isSigned :: Word8 -> Bool Source # shiftL :: Word8 -> Int -> Word8 Source # unsafeShiftL :: Word8 -> Int -> Word8 Source # shiftR :: Word8 -> Int -> Word8 Source # unsafeShiftR :: Word8 -> Int -> Word8 Source # rotateL :: Word8 -> Int -> Word8 Source # rotateR :: Word8 -> Int -> Word8 Source # popCount :: Word8 -> Int Source #
Storable Word8 # | Since: 2.1
Methods sizeOf :: Word8 -> Int Source # alignment :: Word8 -> Int Source # peekElemOff :: Ptr Word8 -> Int -> IO Word8 Source # pokeElemOff :: Ptr Word8 -> Int -> Word8 -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Word8 Source # pokeByteOff :: Ptr b -> Int -> Word8 -> IO () Source # peek :: Ptr Word8 -> IO Word8 Source # poke :: Ptr Word8 -> Word8 -> IO () Source #
PrintfArg Word8 # | Since: 2.1
Methods formatArg :: Word8 -> FieldFormatter Source # parseFormat :: Word8 -> ModifierParser Source #

data Word16 Source #

16-bit unsigned integer type

Instances

Bounded Word16 # | Since: 2.1
Methods minBound :: Word16 Source # maxBound :: Word16 Source #
Enum Word16 # | Since: 2.1
Methods succ :: Word16 -> Word16 Source # pred :: Word16 -> Word16 Source # toEnum :: Int -> Word16 Source # fromEnum :: Word16 -> Int Source # enumFrom :: Word16 -> [Word16] Source # enumFromThen :: Word16 -> Word16 -> [Word16] Source # enumFromTo :: Word16 -> Word16 -> [Word16] Source # enumFromThenTo :: Word16 -> Word16 -> Word16 -> [Word16] Source #
Eq Word16 # | Since: 2.1
Methods (==) :: Word16 -> Word16 -> Bool Source # (/=) :: Word16 -> Word16 -> Bool Source #
Integral Word16 # | Since: 2.1
Methods quot :: Word16 -> Word16 -> Word16 Source # rem :: Word16 -> Word16 -> Word16 Source # div :: Word16 -> Word16 -> Word16 Source # mod :: Word16 -> Word16 -> Word16 Source # quotRem :: Word16 -> Word16 -> (Word16, Word16) Source # divMod :: Word16 -> Word16 -> (Word16, Word16) Source # toInteger :: Word16 -> Integer Source #
Data Word16 # | Since: 4.0.0.0
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word16 -> c Word16 Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word16 Source # toConstr :: Word16 -> Constr Source # dataTypeOf :: Word16 -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Word16) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word16) Source # gmapT :: (forall b. Data b => b -> b) -> Word16 -> Word16 Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word16 -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word16 -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Word16 -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word16 -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word16 -> m Word16 Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word16 -> m Word16 Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word16 -> m Word16 Source #
Num Word16 # | Since: 2.1
Methods (+) :: Word16 -> Word16 -> Word16 Source # (-) :: Word16 -> Word16 -> Word16 Source # (*) :: Word16 -> Word16 -> Word16 Source # negate :: Word16 -> Word16 Source # abs :: Word16 -> Word16 Source # signum :: Word16 -> Word16 Source # fromInteger :: Integer -> Word16 Source #
Ord Word16 # | Since: 2.1
Methods compare :: Word16 -> Word16 -> Ordering Source # (<) :: Word16 -> Word16 -> Bool Source # (<=) :: Word16 -> Word16 -> Bool Source # (>) :: Word16 -> Word16 -> Bool Source # (>=) :: Word16 -> Word16 -> Bool Source # max :: Word16 -> Word16 -> Word16 Source # min :: Word16 -> Word16 -> Word16 Source #
Read Word16 # | Since: 2.1
Methods readsPrec :: Int -> ReadS Word16 Source # readList :: ReadS [Word16] Source # readPrec :: ReadPrec Word16 Source # readListPrec :: ReadPrec [Word16] Source #
Real Word16 # | Since: 2.1
Methods toRational :: Word16 -> Rational Source #
Show Word16 # | Since: 2.1
Methods showsPrec :: Int -> Word16 -> ShowS Source # show :: Word16 -> String Source # showList :: [Word16] -> ShowS Source #
Ix Word16 # | Since: 2.1
Methods range :: (Word16, Word16) -> [Word16] Source # index :: (Word16, Word16) -> Word16 -> Int Source # unsafeIndex :: (Word16, Word16) -> Word16 -> Int inRange :: (Word16, Word16) -> Word16 -> Bool Source # rangeSize :: (Word16, Word16) -> Int Source # unsafeRangeSize :: (Word16, Word16) -> Int
FiniteBits Word16 # | Since: 4.6.0.0
Methods finiteBitSize :: Word16 -> Int Source # countLeadingZeros :: Word16 -> Int Source # countTrailingZeros :: Word16 -> Int Source #
Bits Word16 # | Since: 2.1
Methods (.&.) :: Word16 -> Word16 -> Word16 Source # (.|.) :: Word16 -> Word16 -> Word16 Source # xor :: Word16 -> Word16 -> Word16 Source # complement :: Word16 -> Word16 Source # shift :: Word16 -> Int -> Word16 Source # rotate :: Word16 -> Int -> Word16 Source # zeroBits :: Word16 Source # bit :: Int -> Word16 Source # setBit :: Word16 -> Int -> Word16 Source # clearBit :: Word16 -> Int -> Word16 Source # complementBit :: Word16 -> Int -> Word16 Source # testBit :: Word16 -> Int -> Bool Source # bitSizeMaybe :: Word16 -> Maybe Int Source # bitSize :: Word16 -> Int Source # isSigned :: Word16 -> Bool Source # shiftL :: Word16 -> Int -> Word16 Source # unsafeShiftL :: Word16 -> Int -> Word16 Source # shiftR :: Word16 -> Int -> Word16 Source # unsafeShiftR :: Word16 -> Int -> Word16 Source # rotateL :: Word16 -> Int -> Word16 Source # rotateR :: Word16 -> Int -> Word16 Source # popCount :: Word16 -> Int Source #
Storable Word16 # | Since: 2.1
Methods sizeOf :: Word16 -> Int Source # alignment :: Word16 -> Int Source # peekElemOff :: Ptr Word16 -> Int -> IO Word16 Source # pokeElemOff :: Ptr Word16 -> Int -> Word16 -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Word16 Source # pokeByteOff :: Ptr b -> Int -> Word16 -> IO () Source # peek :: Ptr Word16 -> IO Word16 Source # poke :: Ptr Word16 -> Word16 -> IO () Source #
PrintfArg Word16 # | Since: 2.1
Methods formatArg :: Word16 -> FieldFormatter Source # parseFormat :: Word16 -> ModifierParser Source #

data Word32 Source #

32-bit unsigned integer type

Instances

Bounded Word32 # | Since: 2.1
Methods minBound :: Word32 Source # maxBound :: Word32 Source #
Enum Word32 # | Since: 2.1
Methods succ :: Word32 -> Word32 Source # pred :: Word32 -> Word32 Source # toEnum :: Int -> Word32 Source # fromEnum :: Word32 -> Int Source # enumFrom :: Word32 -> [Word32] Source # enumFromThen :: Word32 -> Word32 -> [Word32] Source # enumFromTo :: Word32 -> Word32 -> [Word32] Source # enumFromThenTo :: Word32 -> Word32 -> Word32 -> [Word32] Source #
Eq Word32 # | Since: 2.1
Methods (==) :: Word32 -> Word32 -> Bool Source # (/=) :: Word32 -> Word32 -> Bool Source #
Integral Word32 # | Since: 2.1
Methods quot :: Word32 -> Word32 -> Word32 Source # rem :: Word32 -> Word32 -> Word32 Source # div :: Word32 -> Word32 -> Word32 Source # mod :: Word32 -> Word32 -> Word32 Source # quotRem :: Word32 -> Word32 -> (Word32, Word32) Source # divMod :: Word32 -> Word32 -> (Word32, Word32) Source # toInteger :: Word32 -> Integer Source #
Data Word32 # | Since: 4.0.0.0
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word32 -> c Word32 Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word32 Source # toConstr :: Word32 -> Constr Source # dataTypeOf :: Word32 -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Word32) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word32) Source # gmapT :: (forall b. Data b => b -> b) -> Word32 -> Word32 Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Word32 -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word32 -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 Source #
Num Word32 # | Since: 2.1
Methods (+) :: Word32 -> Word32 -> Word32 Source # (-) :: Word32 -> Word32 -> Word32 Source # (*) :: Word32 -> Word32 -> Word32 Source # negate :: Word32 -> Word32 Source # abs :: Word32 -> Word32 Source # signum :: Word32 -> Word32 Source # fromInteger :: Integer -> Word32 Source #
Ord Word32 # | Since: 2.1
Methods compare :: Word32 -> Word32 -> Ordering Source # (<) :: Word32 -> Word32 -> Bool Source # (<=) :: Word32 -> Word32 -> Bool Source # (>) :: Word32 -> Word32 -> Bool Source # (>=) :: Word32 -> Word32 -> Bool Source # max :: Word32 -> Word32 -> Word32 Source # min :: Word32 -> Word32 -> Word32 Source #
Read Word32 # | Since: 2.1
Methods readsPrec :: Int -> ReadS Word32 Source # readList :: ReadS [Word32] Source # readPrec :: ReadPrec Word32 Source # readListPrec :: ReadPrec [Word32] Source #
Real Word32 # | Since: 2.1
Methods toRational :: Word32 -> Rational Source #
Show Word32 # | Since: 2.1
Methods showsPrec :: Int -> Word32 -> ShowS Source # show :: Word32 -> String Source # showList :: [Word32] -> ShowS Source #
Ix Word32 # | Since: 2.1
Methods range :: (Word32, Word32) -> [Word32] Source # index :: (Word32, Word32) -> Word32 -> Int Source # unsafeIndex :: (Word32, Word32) -> Word32 -> Int inRange :: (Word32, Word32) -> Word32 -> Bool Source # rangeSize :: (Word32, Word32) -> Int Source # unsafeRangeSize :: (Word32, Word32) -> Int
FiniteBits Word32 # | Since: 4.6.0.0
Methods finiteBitSize :: Word32 -> Int Source # countLeadingZeros :: Word32 -> Int Source # countTrailingZeros :: Word32 -> Int Source #
Bits Word32 # | Since: 2.1
Methods (.&.) :: Word32 -> Word32 -> Word32 Source # (.|.) :: Word32 -> Word32 -> Word32 Source # xor :: Word32 -> Word32 -> Word32 Source # complement :: Word32 -> Word32 Source # shift :: Word32 -> Int -> Word32 Source # rotate :: Word32 -> Int -> Word32 Source # zeroBits :: Word32 Source # bit :: Int -> Word32 Source # setBit :: Word32 -> Int -> Word32 Source # clearBit :: Word32 -> Int -> Word32 Source # complementBit :: Word32 -> Int -> Word32 Source # testBit :: Word32 -> Int -> Bool Source # bitSizeMaybe :: Word32 -> Maybe Int Source # bitSize :: Word32 -> Int Source # isSigned :: Word32 -> Bool Source # shiftL :: Word32 -> Int -> Word32 Source # unsafeShiftL :: Word32 -> Int -> Word32 Source # shiftR :: Word32 -> Int -> Word32 Source # unsafeShiftR :: Word32 -> Int -> Word32 Source # rotateL :: Word32 -> Int -> Word32 Source # rotateR :: Word32 -> Int -> Word32 Source # popCount :: Word32 -> Int Source #
Storable Word32 # | Since: 2.1
Methods sizeOf :: Word32 -> Int Source # alignment :: Word32 -> Int Source # peekElemOff :: Ptr Word32 -> Int -> IO Word32 Source # pokeElemOff :: Ptr Word32 -> Int -> Word32 -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Word32 Source # pokeByteOff :: Ptr b -> Int -> Word32 -> IO () Source # peek :: Ptr Word32 -> IO Word32 Source # poke :: Ptr Word32 -> Word32 -> IO () Source #
PrintfArg Word32 # | Since: 2.1
Methods formatArg :: Word32 -> FieldFormatter Source # parseFormat :: Word32 -> ModifierParser Source #

data Word64 Source #

64-bit unsigned integer type

Instances

Bounded Word64 # | Since: 2.1
Methods minBound :: Word64 Source # maxBound :: Word64 Source #
Enum Word64 # | Since: 2.1
Methods succ :: Word64 -> Word64 Source # pred :: Word64 -> Word64 Source # toEnum :: Int -> Word64 Source # fromEnum :: Word64 -> Int Source # enumFrom :: Word64 -> [Word64] Source # enumFromThen :: Word64 -> Word64 -> [Word64] Source # enumFromTo :: Word64 -> Word64 -> [Word64] Source # enumFromThenTo :: Word64 -> Word64 -> Word64 -> [Word64] Source #
Eq Word64 # | Since: 2.1
Methods (==) :: Word64 -> Word64 -> Bool Source # (/=) :: Word64 -> Word64 -> Bool Source #
Integral Word64 # | Since: 2.1
Methods quot :: Word64 -> Word64 -> Word64 Source # rem :: Word64 -> Word64 -> Word64 Source # div :: Word64 -> Word64 -> Word64 Source # mod :: Word64 -> Word64 -> Word64 Source # quotRem :: Word64 -> Word64 -> (Word64, Word64) Source # divMod :: Word64 -> Word64 -> (Word64, Word64) Source # toInteger :: Word64 -> Integer Source #
Data Word64 # | Since: 4.0.0.0
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word64 -> c Word64 Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word64 Source # toConstr :: Word64 -> Constr Source # dataTypeOf :: Word64 -> DataType Source # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Word64) Source # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word64) Source # gmapT :: (forall b. Data b => b -> b) -> Word64 -> Word64 Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word64 -> r Source # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word64 -> r Source # gmapQ :: (forall d. Data d => d -> u) -> Word64 -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word64 -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 Source #
Num Word64 # | Since: 2.1
Methods (+) :: Word64 -> Word64 -> Word64 Source # (-) :: Word64 -> Word64 -> Word64 Source # (*) :: Word64 -> Word64 -> Word64 Source # negate :: Word64 -> Word64 Source # abs :: Word64 -> Word64 Source # signum :: Word64 -> Word64 Source # fromInteger :: Integer -> Word64 Source #
Ord Word64 # | Since: 2.1
Methods compare :: Word64 -> Word64 -> Ordering Source # (<) :: Word64 -> Word64 -> Bool Source # (<=) :: Word64 -> Word64 -> Bool Source # (>) :: Word64 -> Word64 -> Bool Source # (>=) :: Word64 -> Word64 -> Bool Source # max :: Word64 -> Word64 -> Word64 Source # min :: Word64 -> Word64 -> Word64 Source #
Read Word64 # | Since: 2.1
Methods readsPrec :: Int -> ReadS Word64 Source # readList :: ReadS [Word64] Source # readPrec :: ReadPrec Word64 Source # readListPrec :: ReadPrec [Word64] Source #
Real Word64 # | Since: 2.1
Methods toRational :: Word64 -> Rational Source #
Show Word64 # | Since: 2.1
Methods showsPrec :: Int -> Word64 -> ShowS Source # show :: Word64 -> String Source # showList :: [Word64] -> ShowS Source #
Ix Word64 # | Since: 2.1
Methods range :: (Word64, Word64) -> [Word64] Source # index :: (Word64, Word64) -> Word64 -> Int Source # unsafeIndex :: (Word64, Word64) -> Word64 -> Int inRange :: (Word64, Word64) -> Word64 -> Bool Source # rangeSize :: (Word64, Word64) -> Int Source # unsafeRangeSize :: (Word64, Word64) -> Int
FiniteBits Word64 # | Since: 4.6.0.0
Methods finiteBitSize :: Word64 -> Int Source # countLeadingZeros :: Word64 -> Int Source # countTrailingZeros :: Word64 -> Int Source #
Bits Word64 # | Since: 2.1
Methods (.&.) :: Word64 -> Word64 -> Word64 Source # (.|.) :: Word64 -> Word64 -> Word64 Source # xor :: Word64 -> Word64 -> Word64 Source # complement :: Word64 -> Word64 Source # shift :: Word64 -> Int -> Word64 Source # rotate :: Word64 -> Int -> Word64 Source # zeroBits :: Word64 Source # bit :: Int -> Word64 Source # setBit :: Word64 -> Int -> Word64 Source # clearBit :: Word64 -> Int -> Word64 Source # complementBit :: Word64 -> Int -> Word64 Source # testBit :: Word64 -> Int -> Bool Source # bitSizeMaybe :: Word64 -> Maybe Int Source # bitSize :: Word64 -> Int Source # isSigned :: Word64 -> Bool Source # shiftL :: Word64 -> Int -> Word64 Source # unsafeShiftL :: Word64 -> Int -> Word64 Source # shiftR :: Word64 -> Int -> Word64 Source # unsafeShiftR :: Word64 -> Int -> Word64 Source # rotateL :: Word64 -> Int -> Word64 Source # rotateR :: Word64 -> Int -> Word64 Source # popCount :: Word64 -> Int Source #
Storable Word64 # | Since: 2.1
Methods sizeOf :: Word64 -> Int Source # alignment :: Word64 -> Int Source # peekElemOff :: Ptr Word64 -> Int -> IO Word64 Source # pokeElemOff :: Ptr Word64 -> Int -> Word64 -> IO () Source # peekByteOff :: Ptr b -> Int -> IO Word64 Source # pokeByteOff :: Ptr b -> Int -> Word64 -> IO () Source # peek :: Ptr Word64 -> IO Word64 Source # poke :: Ptr Word64 -> Word64 -> IO () Source #
PrintfArg Word64 # | Since: 2.1
Methods formatArg :: Word64 -> FieldFormatter Source # parseFormat :: Word64 -> ModifierParser Source #

# byte swapping

byteSwap16 :: Word16 -> Word16 Source #

Swap bytes in `Word16`.

Since: 4.7.0.0

byteSwap32 :: Word32 -> Word32 Source #

Reverse order of bytes in `Word32`.

Since: 4.7.0.0

byteSwap64 :: Word64 -> Word64 Source #

Reverse order of bytes in `Word64`.

Since: 4.7.0.0

# Notes

- All arithmetic is performed modulo 2^n, where n is the number of bits in the type. One non-obvious consequence of this is that `negate` should not raise an error on negative arguments.
- For coercing between any two integer types, use `fromIntegral`, which is specialized for all the common cases so should be fast enough. Coercing word types to and from integer types preserves representation, not sign.
- An unbounded size unsigned integer type is available with `Natural`.
- The rules that hold for `Enum` instances over a bounded type such as `Int` (see the section of the Haskell report dealing with arithmetic sequences) also hold for the `Enum` instances over the various `Word` types defined here.
- Right and left shifts by amounts greater than or equal to the width of the type result in a zero result. This is contrary to the behaviour in C, which is undefined; a common interpretation is to truncate the shift count to the width of the type, for example `1 << 32 == 1` in some C implementations.