bv-sized-1.0.5: a bitvector datatype that is parameterized by the vector width

Copyright | (c) Galois Inc. 2018
License | BSD-3
Maintainer | benselfridge@galois.com
Stability | experimental
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.BitVector.Sized.Unsigned

Description

This module defines a wrapper around the `BV` type, `UnsignedBV`, with instances not provided by `BV`.

Synopsis

- newtype UnsignedBV w = UnsignedBV {
  - asBV :: BV w
  }
- mkUnsignedBV :: NatRepr w -> Integer -> UnsignedBV w

# Documentation

newtype UnsignedBV w Source #

Signed bit vector.

Constructors

UnsignedBV |

Fields

- asBV :: BV w

#### Instances

Instances details

Lift (UnsignedBV w :: Type) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods lift :: Quote m => UnsignedBV w -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => UnsignedBV w -> Code m (UnsignedBV w) Source #
KnownNat w => Bits (UnsignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Unsigned

Methods

(.&.) :: UnsignedBV w -> UnsignedBV w -> UnsignedBV w Source #

(.|.) :: UnsignedBV w -> UnsignedBV w -> UnsignedBV w Source #

xor :: UnsignedBV w -> UnsignedBV w -> UnsignedBV w Source #

complement :: UnsignedBV w -> UnsignedBV w Source #

shift :: UnsignedBV w -> Int -> UnsignedBV w Source #

rotate :: UnsignedBV w -> Int -> UnsignedBV w Source #

zeroBits :: UnsignedBV w Source #

bit :: Int -> UnsignedBV w Source #

setBit :: UnsignedBV w -> Int -> UnsignedBV w Source #

clearBit :: UnsignedBV w -> Int -> UnsignedBV w Source #

complementBit :: UnsignedBV w -> Int -> UnsignedBV w Source #

testBit :: UnsignedBV w -> Int -> Bool Source #

bitSizeMaybe :: UnsignedBV w -> Maybe Int Source #

bitSize :: UnsignedBV w -> Int Source #

isSigned :: UnsignedBV w -> Bool Source #

shiftL :: UnsignedBV w -> Int -> UnsignedBV w Source #

unsafeShiftL :: UnsignedBV w -> Int -> UnsignedBV w Source #

shiftR :: UnsignedBV w -> Int -> UnsignedBV w Source #

unsafeShiftR :: UnsignedBV w -> Int -> UnsignedBV w Source #

rotateL :: UnsignedBV w -> Int -> UnsignedBV w Source #

rotateR :: UnsignedBV w -> Int -> UnsignedBV w Source #

popCount :: UnsignedBV w -> Int Source #

KnownNat w => FiniteBits (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods finiteBitSize :: UnsignedBV w -> Int Source # countLeadingZeros :: UnsignedBV w -> Int Source # countTrailingZeros :: UnsignedBV w -> Int Source #
KnownNat w => Bounded (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods minBound :: UnsignedBV w Source # maxBound :: UnsignedBV w Source #
KnownNat w => Enum (UnsignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Unsigned

Methods

succ :: UnsignedBV w -> UnsignedBV w Source #

pred :: UnsignedBV w -> UnsignedBV w Source #

toEnum :: Int -> UnsignedBV w Source #

fromEnum :: UnsignedBV w -> Int Source #

enumFrom :: UnsignedBV w -> [UnsignedBV w] Source #

enumFromThen :: UnsignedBV w -> UnsignedBV w -> [UnsignedBV w] Source #

enumFromTo :: UnsignedBV w -> UnsignedBV w -> [UnsignedBV w] Source #

enumFromThenTo :: UnsignedBV w -> UnsignedBV w -> UnsignedBV w -> [UnsignedBV w] Source #

Generic (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Associated Types type Rep (UnsignedBV w) :: Type -> Type Source # Methods from :: UnsignedBV w -> Rep (UnsignedBV w) x Source # to :: Rep (UnsignedBV w) x -> UnsignedBV w Source #
KnownNat w => Ix (UnsignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Unsigned

Methods

range :: (UnsignedBV w, UnsignedBV w) -> [UnsignedBV w] Source #

index :: (UnsignedBV w, UnsignedBV w) -> UnsignedBV w -> Int Source #

unsafeIndex :: (UnsignedBV w, UnsignedBV w) -> UnsignedBV w -> Int Source #

inRange :: (UnsignedBV w, UnsignedBV w) -> UnsignedBV w -> Bool Source #

rangeSize :: (UnsignedBV w, UnsignedBV w) -> Int Source #

unsafeRangeSize :: (UnsignedBV w, UnsignedBV w) -> Int Source #

KnownNat w => Num (UnsignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Unsigned

Methods

(+) :: UnsignedBV w -> UnsignedBV w -> UnsignedBV w Source #

(-) :: UnsignedBV w -> UnsignedBV w -> UnsignedBV w Source #

(*) :: UnsignedBV w -> UnsignedBV w -> UnsignedBV w Source #

negate :: UnsignedBV w -> UnsignedBV w Source #

abs :: UnsignedBV w -> UnsignedBV w Source #

signum :: UnsignedBV w -> UnsignedBV w Source #

fromInteger :: Integer -> UnsignedBV w Source #

Read (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods readsPrec :: Int -> ReadS (UnsignedBV w) Source # readList :: ReadS [UnsignedBV w] Source # readPrec :: ReadPrec (UnsignedBV w) Source # readListPrec :: ReadPrec [UnsignedBV w] Source #
Show (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods showsPrec :: Int -> UnsignedBV w -> ShowS Source # show :: UnsignedBV w -> String Source # showList :: [UnsignedBV w] -> ShowS Source #
NFData (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods rnf :: UnsignedBV w -> () Source #
Eq (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods (==) :: UnsignedBV w -> UnsignedBV w -> Bool Source # (/=) :: UnsignedBV w -> UnsignedBV w -> Bool Source #
Ord (UnsignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Unsigned

Methods

compare :: UnsignedBV w -> UnsignedBV w -> Ordering Source #

(<) :: UnsignedBV w -> UnsignedBV w -> Bool Source #

(<=) :: UnsignedBV w -> UnsignedBV w -> Bool Source #

(>) :: UnsignedBV w -> UnsignedBV w -> Bool Source #

(>=) :: UnsignedBV w -> UnsignedBV w -> Bool Source #

max :: UnsignedBV w -> UnsignedBV w -> UnsignedBV w Source #

min :: UnsignedBV w -> UnsignedBV w -> UnsignedBV w Source #

Hashable (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods hashWithSalt :: Int -> UnsignedBV w -> Int # hash :: UnsignedBV w -> Int #
KnownNat w => Random (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods randomR :: RandomGen g => (UnsignedBV w, UnsignedBV w) -> g -> (UnsignedBV w, g) Source # random :: RandomGen g => g -> (UnsignedBV w, g) Source # randomRs :: RandomGen g => (UnsignedBV w, UnsignedBV w) -> g -> [UnsignedBV w] Source # randoms :: RandomGen g => g -> [UnsignedBV w] Source #
KnownNat w => Uniform (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods uniformM :: StatefulGen g m => g -> m (UnsignedBV w) Source #
UniformRange (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned Methods uniformRM :: StatefulGen g m => (UnsignedBV w, UnsignedBV w) -> g -> m (UnsignedBV w) Source #
type Rep (UnsignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Unsigned type Rep (UnsignedBV w) = D1 ('MetaData "UnsignedBV" "Data.BitVector.Sized.Unsigned" "bv-sized-1.0.5-IDKhEWZ3nUo3z3zx0EtHRF" 'True) (C1 ('MetaCons "UnsignedBV" 'PrefixI 'True) (S1 ('MetaSel ('Just "asBV") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (BV w))))

mkUnsignedBV :: NatRepr w -> Integer -> UnsignedBV w Source #

Convenience wrapper for `mkBV`.