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 #
toJSON :: SatInt -> Value Source #
toEncoding :: SatInt -> Encoding Source #
toJSONList :: [ SatInt ] -> Value Source #
toEncodingList :: [ SatInt ] -> Encoding Source #
parseJSON :: Value -> Parser SatInt Source #
parseJSONList :: Value -> Parser [ 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 #
parseField :: Field -> Parser SatInt Source #
sizeOf# :: SatInt -> Int# Source #
alignment# :: SatInt -> Int# Source #
indexByteArray# :: ByteArray# -> Int# -> SatInt Source #
readByteArray# :: MutableByteArray# s -> Int# -> State# s -> (# State# s, SatInt #) Source #
writeByteArray# :: MutableByteArray# s -> Int# -> SatInt -> State# s -> State# s Source #
setByteArray# :: MutableByteArray# s -> Int# -> Int# -> SatInt -> State# s -> State# s Source #
indexOffAddr# :: Addr# -> Int# -> SatInt Source #
readOffAddr# :: Addr# -> Int# -> State# s -> (# State# s, SatInt #) Source #
writeOffAddr# :: Addr# -> Int# -> SatInt -> State# s -> State# s Source #
setOffAddr# :: Addr# -> Int# -> Int# -> SatInt -> State# s -> State# s Source #
noThunks :: Context -> SatInt -> IO ( Maybe ThunkInfo ) Source #
wNoThunks :: Context -> SatInt -> IO ( Maybe ThunkInfo ) Source #
showTypeOf :: Proxy SatInt -> String Source #
Defined in PlutusCore.Evaluation.Machine.ExMemory
memoryUsage :: SatInt -> ExMemory Source #
lift :: SatInt -> Q Exp Source #
liftTyped :: SatInt -> Q ( TExp SatInt ) Source #