| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Snowchecked.Internal.Import
Synopsis
- cutBits :: (Num a, Bits a) => a -> Int -> a
- cutShiftBits :: (Num a, Bits a) => a -> Int -> Int -> a
- shiftCutBits :: (Num a, Bits a) => a -> Int -> Int -> a
- toInt :: Integral a => a -> Int
- toWord8 :: Integral a => a -> Word8
- toWord32 :: Integral a => a -> Word32
- module Data.Snowchecked.Types
- class Eq a => Bits a where
- module Data.WideWord.Word256
- module Data.Word
- module Numeric
Documentation
module Data.Snowchecked.Types
The Bits class defines bitwise operations over integral types.
- Bits are numbered from 0 with bit 0 being the least significant bit.
Minimal complete definition
(.&.), (.|.), xor, complement, (shift | shiftL, shiftR), (rotate | rotateL, rotateR), bitSize, bitSizeMaybe, isSigned, testBit, bit, popCount
Methods
(.&.) :: a -> a -> a infixl 7 #
Bitwise "and"
(.|.) :: a -> a -> a infixl 5 #
Bitwise "or"
shiftL :: a -> Int -> a infixl 8 #
Shift the argument left by the specified number of bits
(which must be non-negative). Some instances may throw an
Overflow exception if given a negative input.
An instance can define either this and shiftR or the unified
shift, depending on which is more convenient for the type in
question.
shiftR :: a -> Int -> a infixl 8 #
Shift the first argument right by the specified number of bits. The
result is undefined for negative shift amounts and shift amounts
greater or equal to the bitSize. Some instances may throw an
Overflow exception if given a negative input.
Right shifts perform sign extension on signed number types;
i.e. they fill the top bits with 1 if the x is negative
and with 0 otherwise.
An instance can define either this and shiftL or the unified
shift, depending on which is more convenient for the type in
question.
Instances
module Data.WideWord.Word256
module Data.Word
module Numeric