# Int8

## Definitions

`def abs(x: Int8): Int8`

Returns the absolute value of `x`. If the absolute value exceeds maxValue(), -1 is returned.

`def bitCount(x: Int8): Int32`

Returns the number of one-bits in the two's complement binary representation of `x`.

`def bitwiseAnd(x: Int8, y: Int8): Int8`

Returns the bitwise AND of `x` and `y`.

`def bitwiseNot(x: Int8): Int8`

Returns the bitwise NOT of `x`.

`def bitwiseOr(x: Int8, y: Int8): Int8`

Returns the bitwise OR of `x` and `y`.

`def bitwiseXor(x: Int8, y: Int8): Int8`

Returns the bitwise XOR of `x` and `y`.

`def byteValue(i: java.lang.Byte): Int8`

Get the primitive Int8 value from its object representation (i.e. ##java.lang.Byte).

This function is expected to be used when marshaling Int8s from Java. Generally in Flix code you should not need to use `##java.lang.Byte`.

`def clearBit(pos: { pos = Int32 }, x: Int8): Int8`

Returns `x` with the bit at position `pos` cleared (to 0). Considers the 5 rightmost bits of `pos` (`pos` mod 32). The bits of x have positions: 0 (rightmost bit) - 7 (leftmost bit)

`def compare(x: Int8, y: Int8): Int32`

Returns 1 if x > y, -1 if x < y, and 0 if x = y. The sign of x - y.

`def dist(x: Int8, y: Int8): Int8`

Returns the distance between `x` and `y`. If this distance exceeds maxValue(), -1 is returned.

`def factorial(x: Int8): Int32`

Returns the factorial of `x`.

`def flipBit(pos: { pos = Int32 }, x: Int8): Int8`

Returns `x` with the bit at position `pos` flipped. Considers the 5 rightmost bits of `pos` (`pos` mod 32). The bits of x have positions: 0 (rightmost bit) - 7 (leftmost bit)

`def fromString(s: String): Option[Int8]`

Parse the string `s` as an Int8, leading or trailing whitespace is trimmed. A successful parse is wrapped with `Some(x)`, a parse failure is indicated by `None`.

`def getBit(pos: { pos = Int32 }, x: Int8): Int32`

Returns the bit of `x` at `pos` (either 0 or 1). Considers the 5 rightmost bits of `pos` (`pos` mod 32). The bits of x have positions: 0 (rightmost bit) - 7 (leftmost bit)

`def highestOneBit(x: Int8): Int8`

Returns a value with at most a single one-bit, in the position of the highest-order/leftmost one-bit in `x`. Returns 0 if x=0.

`def highestOneBitPosition(x: Int8): Int32`

Returns the position of the highest-order/leftmost one-bit in `x`. Possible return values: 0 (rightmost bit) - 7 (leftmost bit) -1 if x = 0

`def leftShift(x: Int8, y: Int32): Int8`

Returns `x` with the bits shifted left by `y` places

`def log2(x: Int8): Int8`

Returns the integer binary logarithm of `x`. If the given value is 0 or negative, 0 is returned.

`def logicalRightShift(dist: { dist = Int32 }, x: Int8): Int8`

Returns the logical right shift of `x` by `distance`. Only the rightmost 5 bits of `distance` are considered (ie. `distance rem 32`). A zero is shifted into the leftmost position regardless of sign extension.

`def lowestOneBit(x: Int8): Int8`

Returns a value with at most a single one-bit, in the position of the highest-order/leftmost one-bit in `x`. Returns 0 if x=0.

`def lowestOneBitPosition(x: Int8): Int32`

Returns the position of the lowest-order/rightmost one-bit in `x`. Possible return values: 0 (rightmost bit) - 7 (leftmost bit) -1 if x = 0

`def max(x: Int8, y: Int8): Int8`

Returns the larger of `x` and `y`.

`def maxValue(): Int8`

Returns the maximum number representable by an `Int8`.

`def min(x: Int8, y: Int8): Int8`

Returns the smaller of `x` and `y`.

`def minValue(): Int8`

Returns the minimum number representable by an `Int8`.

`def modulo(x: Int8, n: Int8): Int8`

Returns the Euclidean modulo of `x` and `n`. The result is always non-negative.

`def numberOfLeadingZeros(x: Int8): Int32`

Returns the number of zero bits preceding the highest-order/leftmost one-bit in `x`. Returns 8 if x=0.

`def numberOfTrailingZeros(x: Int8): Int32`

Returns the number of zero bits following the lowest-order/rightmost one-bit in `x`. Returns 8 if x=0.

`def pow(b: Int8, n: Int8): Int8`

Returns `b` raised to the power of `n`.

`def remainder(x: Int8, n: Int8): Int8`

Returns the remainder of `x / n`. The result can be negative.

See also `Int8.modulo`.

`def reverse(x: Int8): Int8`

Returns the value obtained by reversing the bits in the two's complement binary representation of `x`.

`def rightShift(x: Int8, y: Int32): Int8`

Returns `x` with the bits shifted right by `y` places

`def rotateLeft(dist: { dist = Int32 }, x: Int8): Int8`

Returns the the value obtained by rotating the two's complement binary representation of `x` left by `distance` bits.

`def rotateRight(dist: { dist = Int32 }, x: Int8): Int8`

Returns the the value obtained by rotating the two's complement binary representation of `x` right by `distance` bits.

`def setBit(pos: { pos = Int32 }, x: Int8): Int8`

Returns `x` with the bit at position `pos` set (to 1). Considers the 5 rightmost bits of `pos` (`pos` mod 32). The bits of x have positions: 0 (rightmost bit) - 7 (leftmost bit)

`def signum(x: Int8): Int32`

Returns 1 if x > 0, -1 if x < 0, and 0 if x = 0. The sign of x.

`def size(): Int32`

Returns the number of bits used to represent an `Int8`.

`def toBigDecimal(x: Int8): BigDecimal`

Convert `x` to a BigDecimal.

The numeric value of `x` is preserved exactly.

`def toBigInt(x: Int8): BigInt`

Convert `x` to a BigInt.

The numeric value of `x` is preserved exactly.

`def toFloat32(x: Int8): Float32`

Convert `x` to a Float32.

The numeric value of `x` is preserved exactly.

`def toFloat64(x: Int8): Float64`

Convert `x` to a Float64.

The numeric value of `x` is preserved exactly.

`def toInt16(x: Int8): Int16`

Convert `x` to an Int16.

The numeric value of `x` is preserved exactly.

`def toInt32(x: Int8): Int32`

Convert `x` to an Int32.

The numeric value of `x` is preserved exactly.

`def toInt64(x: Int8): Int64`

Convert `x` to an Int64.

The numeric value of `x` is preserved exactly.

`def toString(x: Int8): String`

Return a string representation of `x`.

`def valueOf(i: Int8): java.lang.Byte`

Convert an Int8 value to its object representation (i.e. ##java.lang.Byte).

This function is expected to be used when marshaling Int8s to Java. Generally in Flix code you should not need to use `##java.lang.Byte`.