RxIntExt extension

Extension providing additional functionality for int values wrapped in an Rx object.

on

Properties

bitLength int
Returns the minimum number of bits required to store this integer.
no setter
isEven bool
Returns true if and only if this integer is even.
no setter
isOdd bool
Returns true if and only if this integer is odd.
no setter
sign int
Returns the sign of this integer.
no setter

Methods

abs() int
Returns the absolute value of this integer.
ceilToDouble() double
Returns this.toDouble().
floorToDouble() double
Returns this.toDouble().
gcd(int other) int
Returns the greatest common divisor of this integer and other.
modInverse(int modulus) int
Returns the modular multiplicative inverse of this integer modulo modulus.
modPow(int exponent, int modulus) int
Returns this integer to the power of exponent modulo modulus.
roundToDouble() double
Returns this.toDouble().
toSigned(int width) int
Returns the least significant width bits of this integer, extending the highest retained bit to the sign. This is the same as truncating the value to fit in width bits using an signed 2-s complement representation. The returned value has the same bit value in all positions higher than width.
toUnsigned(int width) int
Returns the least significant width bits of this integer as a non-negative number (i.e. unsigned representation). The returned value has zeros in all bit positions higher than width.
truncateToDouble() double
Returns this.toDouble().

Operators

operator &(int other) int
Bit-wise and operator.
operator <<(int shiftAmount) int
Shift the bits of this integer to the left by shiftAmount.
operator >>(int shiftAmount) int
Shift the bits of this integer to the right by shiftAmount.
operator ^(int other) int
Bit-wise exclusive-or operator.
operator unary-() int
Return the negative value of this integer.
operator |(int other) int
Bit-wise or operator.
operator ~() int
The bit-wise negate operator.