Class LargeIntHandler
java.lang.Object
com.pnfsoftware.jeb.util.primitives.LargeIntHandler
Handler for large integers of a given maximum bitsize. Those objects are created through a
factory method.
-
Method Summary
Modifier and TypeMethodDescriptionadd(BigInteger a, BigInteger b) and(BigInteger a, BigInteger b) clearbit(BigInteger a, int n) intcompare(BigInteger a, BigInteger b) intcompareU(BigInteger a, BigInteger b) static LargeIntHandlercreate(int bitsize) Create a new big integer.div2S(BigInteger a, BigInteger b) div2U(BigInteger a, BigInteger b) divS(BigInteger a, BigInteger b) divU(BigInteger a, BigInteger b) intmul2S(BigInteger a, BigInteger b) mul2U(BigInteger a, BigInteger b) mulS(BigInteger a, BigInteger b) mulU(BigInteger a, BigInteger b) neg(BigInteger a) not(BigInteger a) or(BigInteger a, BigInteger b) remS(BigInteger a, BigInteger b) remU(BigInteger a, BigInteger b) rol(BigInteger a, int n) ror(BigInteger a, int n) sar(BigInteger a, int n) shift with modulo-count (positive)setbit(BigInteger a, int n) shl(BigInteger a, int n) shift with modulo-count (positive)shr(BigInteger a, int n) shift with modulo-count (positive)sub(BigInteger a, BigInteger b) booleantestbit(BigInteger a, int n) Get the unsigned equivalent of the provided truncated integer.Truncate and store as a signed value.Truncate and store as a signed value.xor(BigInteger a, BigInteger b)
-
Method Details
-
create
-
getBitsize
public int getBitsize() -
create
Create a new big integer. The client is responsible for making sure that the two-complement representation of the value fits withinbitsizebits.- Parameters:
val-- Returns:
-
truncate
Truncate and store as a signed value. The resulting integer 2-complement representation holds on at mostbitsizebits.- Parameters:
val- string value (decimal, hex, or octal - with the right associated prefix or suffix)- Returns:
-
truncate
Truncate and store as a signed value. The resulting integer 2-complement representation holds on at mostbitsizebits.- Parameters:
v-- Returns:
-
toUnsigned
Get the unsigned equivalent of the provided truncated integer.Warning, this method is unsafe! The result may no longer be representable on bitsize bits.
- Parameters:
a-- Returns:
-
neg
-
add
-
sub
-
mulS
-
mulU
-
mul2S
-
mul2U
-
divS
-
divU
-
remS
-
remU
-
div2S
-
div2U
-
and
-
or
-
not
-
xor
-
testbit
-
setbit
-
clearbit
-
shl
shift with modulo-count (positive) -
shr
shift with modulo-count (positive) -
sar
shift with modulo-count (positive) -
ror
-
rol
-
compare
-
compareU
-
toUnsignedHexString
-