I8 extension type

An 8-bit signed integer primitive.

This provides a zero-cost abstraction for 8-bit signed math, automatically wrapping on overflow and providing C++-style boundaries.

on
Implemented types
Available extensions

Constructors

I8(int value)
const

Properties

address Pointer<Never>

Available on int, provided by the IntAddress extension

The memory address of the underlying data.
no setter
bitLength int
Returns the minimum number of bits required to store this integer.
no setterinherited
hashCode int
Returns a hash code for a numerical value.
no setterinherited
isEven bool
Returns true if and only if this integer is even.
no setterinherited
isFinite bool
Whether this number is finite.
no setterinherited
isInfinite bool
Whether this number is positive infinity or negative infinity.
no setterinherited
isNaN bool
Whether this number is a Not-a-Number value.
no setterinherited
isNegative bool
Whether this number is negative.
no setterinherited
isOdd bool
Returns true if and only if this integer is odd.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sign int
Returns the sign of this integer.
no setterinherited
toJS JSNumber

Available on num, provided by the NumToJSExtension extension

Converts this num to a JSNumber.
no setter
value int
final

Methods

abs() int
Returns the absolute value of this integer.
inherited
addChecked(I8 other) I8
Adds another I8 to this, throwing a StateError on overflow or underflow.
ceil() int
Returns this.
inherited
ceilToDouble() double
Returns this.toDouble().
inherited
clamp(num lowerLimit, num upperLimit) num
Returns this num clamped to be in the range lowerLimit-upperLimit.
inherited
compareTo(num other) int
Compares this to other.
inherited
floor() int
Returns this.
inherited
floorToDouble() double
Returns this.toDouble().
inherited
gcd(int other) int
Returns the greatest common divisor of this integer and other.
inherited
modInverse(int modulus) int
Returns the modular multiplicative inverse of this integer modulo modulus.
inherited
modPow(int exponent, int modulus) int
Returns this integer to the power of exponent modulo modulus.
inherited
mulChecked(I8 other) I8
Multiplies this by another I8, throwing a StateError on overflow or underflow.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remainder(num other) num
The remainder of the truncating division of this by other.
inherited
round() int
Returns this.
inherited
roundToDouble() double
Returns this.toDouble().
inherited
subChecked(I8 other) I8
Subtracts another I8 from this, throwing a StateError on overflow or underflow.
toDouble() double
This number as a double.
inherited
toInt() int
Truncates this num to an integer and returns the result as an int.
inherited
toRadixString(int radix) String
Converts this int to a string representation in the given radix.
inherited
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.
inherited
toString() String
Returns a string representation of this integer.
inherited
toStringAsExponential([int? fractionDigits]) String
An exponential string-representation of this number.
inherited
toStringAsFixed(int fractionDigits) String
A decimal-point string-representation of this number.
inherited
toStringAsPrecision(int precision) String
A string representation with precision significant digits.
inherited
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.
inherited
truncate() int
Returns this.
inherited
truncateToDouble() double
Returns this.toDouble().
inherited

Operators

operator %(I8 other) I8
Modulo operator, wrapping around to remain within I8.
override
operator &(I8 other) I8
Performs bitwise AND.
override
operator *(I8 other) I8
Multiplies this by another I8, wrapping around on overflow/underflow.
override
operator +(I8 other) I8
Adds another I8 to this, wrapping around on overflow/underflow.
override
operator -(I8 other) I8
Subtracts another I8 from this, wrapping around on overflow/underflow.
override
operator /(num other) double
Divides this number by other.
inherited
operator <(num other) bool
Whether this number is numerically smaller than other.
inherited
operator <<(int shiftAmount) I8
Left shifts by shiftAmount bits.
override
operator <=(num other) bool
Whether this number is numerically smaller than or equal to other.
inherited
operator ==(Object other) bool
Test whether this value is numerically equal to other.
inherited
operator >(num other) bool
Whether this number is numerically greater than other.
inherited
operator >=(num other) bool
Whether this number is numerically greater than or equal to other.
inherited
operator >>(int shiftAmount) I8
Right shifts by shiftAmount bits.
override
operator >>>(int shiftAmount) I8
Unsigned right shift.
override
operator ^(I8 other) I8
Performs bitwise XOR.
override
operator unary-() I8
Returns the negated value.
override
operator |(I8 other) I8
Performs bitwise OR.
override
operator ~() I8
Performs bitwise NOT.
override
operator ~/(I8 other) I8
Divides this by another I8, wrapping around on overflow/underflow.
override

Constants

max → const I8
The maximum value an I8 can hold (127).
min → const I8
The minimum value an I8 can hold (-128).