bv-sized-1.0.6: 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 | None
Language | Haskell2010

Data.BitVector.Sized.Signed

Description

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

Synopsis

- newtype SignedBV (w :: Nat) = SignedBV {
  - asBV :: BV w
  }
- mkSignedBV :: forall (w :: Nat). NatRepr w -> Integer -> SignedBV w

# Documentation

newtype SignedBV (w :: Nat) Source #

Signed bit vector.

Constructors

SignedBV |

Fields

- asBV :: BV w

#### Instances

Instances details

Lift (SignedBV w :: Type) Source # |
Instance details Defined in Data.BitVector.Sized.Signed Methods lift :: Quote m => SignedBV w -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => SignedBV w -> Code m (SignedBV w) Source #
NFData (SignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Signed Methods rnf :: SignedBV w -> () Source #
(KnownNat w, 1 <= w) => Bits (SignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Signed

Methods

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

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

xor :: SignedBV w -> SignedBV w -> SignedBV w Source #

complement :: SignedBV w -> SignedBV w Source #

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

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

zeroBits :: SignedBV w Source #

bit :: Int -> SignedBV w Source #

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

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

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

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

bitSizeMaybe :: SignedBV w -> Maybe Int Source #

bitSize :: SignedBV w -> Int Source #

isSigned :: SignedBV w -> Bool Source #

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

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

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

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

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

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

popCount :: SignedBV w -> Int Source #

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

Instance details

Defined in Data.BitVector.Sized.Signed

Methods

succ :: SignedBV w -> SignedBV w Source #

pred :: SignedBV w -> SignedBV w Source #

toEnum :: Int -> SignedBV w Source #

fromEnum :: SignedBV w -> Int Source #

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

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

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

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

Generic (SignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Signed

Associated Types

type Rep (SignedBV w) |
Instance details Defined in Data.BitVector.Sized.Signed type Rep (SignedBV w) = D1 ('MetaData "SignedBV" "Data.BitVector.Sized.Signed" "bv-sized-1.0.6-2VgGESQNLBVBh9nZmgdLKo" 'True) (C1 ('MetaCons "SignedBV" 'PrefixI 'True) (S1 ('MetaSel ('Just "asBV") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (BV w))))

Methods

from :: SignedBV w -> Rep (SignedBV w) x Source #

to :: Rep (SignedBV w) x -> SignedBV w Source #

(KnownNat w, 1 <= w) => Ix (SignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Signed

Methods

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

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

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

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

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

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

(KnownNat w, 1 <= w) => Num (SignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Signed

Methods

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

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

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

negate :: SignedBV w -> SignedBV w Source #

abs :: SignedBV w -> SignedBV w Source #

signum :: SignedBV w -> SignedBV w Source #

fromInteger :: Integer -> SignedBV w Source #

Read (SignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Signed Methods readsPrec :: Int -> ReadS (SignedBV w) Source # readList :: ReadS [SignedBV w] Source # readPrec :: ReadPrec (SignedBV w) Source # readListPrec :: ReadPrec [SignedBV w] Source #
Show (SignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Signed Methods showsPrec :: Int -> SignedBV w -> ShowS Source # show :: SignedBV w -> String Source # showList :: [SignedBV w] -> ShowS Source #
Eq (SignedBV w) Source # |
Instance details Defined in Data.BitVector.Sized.Signed Methods (==) :: SignedBV w -> SignedBV w -> Bool Source # (/=) :: SignedBV w -> SignedBV w -> Bool Source #
(KnownNat w, 1 <= w) => Ord (SignedBV w) Source # |

Instance details

Defined in Data.BitVector.Sized.Signed

Methods

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

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

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

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

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

max :: SignedBV w -> SignedBV w -> SignedBV w Source #

min :: SignedBV w -> SignedBV w -> SignedBV w Source #

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

mkSignedBV :: forall (w :: Nat). NatRepr w -> Integer -> SignedBV w Source #

Convenience wrapper for `mkBV`.