Copyright | (c) Sirui Lu 2021-2023 |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | siruilu@cs.washington.edu |
Stability | Experimental |
Portability | GHC only |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- class Bits a => SymRotate a where
- symRotate :: a -> a -> a
- symRotateNegated :: a -> a -> a
- newtype DefaultFiniteBitsSymRotate a = DefaultFiniteBitsSymRotate {}
Documentation
class Bits a => SymRotate a where Source #
The symRotate
is similar to rotate
, but accepts the type itself instead
of Int
for the rotate amount. The function works on all inputs, including
the rotate amounts that are beyond the bit width of the value.
The symRotateNegated
function rotates to the opposite direction of
symRotate
. This function is introduced to handle the asymmetry of the range
of values.
Instances
SymRotate Int16 Source # | |
SymRotate Int32 Source # | |
SymRotate Int64 Source # | |
SymRotate Int8 Source # | |
SymRotate Word16 Source # | |
SymRotate Word32 Source # | |
SymRotate Word64 Source # | |
SymRotate Word8 Source # | |
SymRotate Int Source # | |
SymRotate Word Source # | |
(Integral a, FiniteBits a) => SymRotate (DefaultFiniteBitsSymRotate a) Source # | |
(KnownNat n, 1 <= n) => SymRotate (IntN n) Source # | |
(KnownNat n, 1 <= n) => SymRotate (WordN n) Source # | |
(forall (n :: Nat). (KnownNat n, 1 <= n) => SymRotate (bv n), forall (n :: Nat). (KnownNat n, 1 <= n) => Num (bv n)) => SymRotate (SomeBV bv) Source # | |
(KnownNat n, 1 <= n) => SymRotate (SymIntN n) Source # | |
(KnownNat n, 1 <= n) => SymRotate (SymWordN n) Source # | |
newtype DefaultFiniteBitsSymRotate a Source #
A newtype wrapper. Use this to derive SymRotate
for types that have
FiniteBits
instances.