Data.SatInt
Description
Adapted from SafeInt to perform saturating arithmetic (i.e. returning max or min bounds) instead of throwing on overflow.
SafeInt
This is not quite as fast as using Int or Int64 directly, but we need the safety.
Int
Int64
data SatInt Source #
Defined in Data.SatInt
Methods
minBound :: SatInt Source #
maxBound :: SatInt Source #
succ :: SatInt -> SatInt Source #
pred :: SatInt -> SatInt Source #
toEnum :: Int -> SatInt Source #
fromEnum :: SatInt -> Int Source #
enumFrom :: SatInt -> [SatInt] Source #
enumFromThen :: SatInt -> SatInt -> [SatInt] Source #
enumFromTo :: SatInt -> SatInt -> [SatInt] Source #
enumFromThenTo :: SatInt -> SatInt -> SatInt -> [SatInt] Source #
(==) :: SatInt -> SatInt -> Bool Source #
(/=) :: SatInt -> SatInt -> Bool Source #
quot :: SatInt -> SatInt -> SatInt Source #
rem :: SatInt -> SatInt -> SatInt Source #
div :: SatInt -> SatInt -> SatInt Source #
mod :: SatInt -> SatInt -> SatInt Source #
quotRem :: SatInt -> SatInt -> (SatInt, SatInt) Source #
divMod :: SatInt -> SatInt -> (SatInt, SatInt) Source #
toInteger :: SatInt -> Integer Source #
In the Num instance, we plug in our own addition, multiplication and subtraction function that perform overflow-checking.
Num
(+) :: SatInt -> SatInt -> SatInt Source #
(-) :: SatInt -> SatInt -> SatInt Source #
(*) :: SatInt -> SatInt -> SatInt Source #
negate :: SatInt -> SatInt Source #
abs :: SatInt -> SatInt Source #
signum :: SatInt -> SatInt Source #
fromInteger :: Integer -> SatInt Source #
compare :: SatInt -> SatInt -> Ordering Source #
(<) :: SatInt -> SatInt -> Bool Source #
(<=) :: SatInt -> SatInt -> Bool Source #
(>) :: SatInt -> SatInt -> Bool Source #
(>=) :: SatInt -> SatInt -> Bool Source #
max :: SatInt -> SatInt -> SatInt Source #
min :: SatInt -> SatInt -> SatInt Source #
readsPrec :: Int -> ReadS SatInt Source #
readList :: ReadS [SatInt] Source #
readPrec :: ReadPrec SatInt Source #
readListPrec :: ReadPrec [SatInt] Source #
toRational :: SatInt -> Rational Source #
showsPrec :: Int -> SatInt -> ShowS Source #
show :: SatInt -> String Source #
showList :: [SatInt] -> ShowS Source #
Associated Types
type Rep SatInt :: Type -> Type Source #
from :: SatInt -> Rep SatInt x Source #
to :: Rep SatInt x -> SatInt Source #
(.&.) :: SatInt -> SatInt -> SatInt Source #
(.|.) :: SatInt -> SatInt -> SatInt Source #
xor :: SatInt -> SatInt -> SatInt Source #
complement :: SatInt -> SatInt Source #
shift :: SatInt -> Int -> SatInt Source #
rotate :: SatInt -> Int -> SatInt Source #
zeroBits :: SatInt Source #
bit :: Int -> SatInt Source #
setBit :: SatInt -> Int -> SatInt Source #
clearBit :: SatInt -> Int -> SatInt Source #
complementBit :: SatInt -> Int -> SatInt Source #
testBit :: SatInt -> Int -> Bool Source #
bitSizeMaybe :: SatInt -> Maybe Int Source #
bitSize :: SatInt -> Int Source #
isSigned :: SatInt -> Bool Source #
shiftL :: SatInt -> Int -> SatInt Source #
unsafeShiftL :: SatInt -> Int -> SatInt Source #
shiftR :: SatInt -> Int -> SatInt Source #
unsafeShiftR :: SatInt -> Int -> SatInt Source #
rotateL :: SatInt -> Int -> SatInt Source #
rotateR :: SatInt -> Int -> SatInt Source #
popCount :: SatInt -> Int Source #
finiteBitSize :: SatInt -> Int Source #
countLeadingZeros :: SatInt -> Int Source #
countTrailingZeros :: SatInt -> Int Source #
rnf :: SatInt -> () Source #
parseJSON :: Value -> Parser SatInt
parseJSONList :: Value -> Parser [SatInt]
toJSON :: SatInt -> Value
toEncoding :: SatInt -> Encoding
toJSONList :: [SatInt] -> Value
toEncodingList :: [SatInt] -> Encoding
sizeOf# :: SatInt -> Int#
alignment# :: SatInt -> Int#
indexByteArray# :: ByteArray# -> Int# -> SatInt
readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, SatInt #)
writeByteArray# :: MutableByteArray# s -> Int# -> SatInt -> State# s -> State# s
setByteArray# :: MutableByteArray# s -> Int# -> Int# -> SatInt -> State# s -> State# s
indexOffAddr# :: Addr# -> Int# -> SatInt
readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, SatInt #)
writeOffAddr# :: Addr# -> Int# -> SatInt -> State# s -> State# s
setOffAddr# :: Addr# -> Int# -> Int# -> SatInt -> State# s -> State# s
noThunks :: Context -> SatInt -> IO (Maybe ThunkInfo)
wNoThunks :: Context -> SatInt -> IO (Maybe ThunkInfo)
showTypeOf :: Proxy SatInt -> String
parseField :: Field -> Parser SatInt
Defined in PlutusCore.Evaluation.Machine.ExMemory
memoryUsage :: SatInt -> ExMemory Source #
lift :: SatInt -> Q Exp Source #
liftTyped :: SatInt -> Q (TExp SatInt) Source #