Int8
Utilities for working with the Int8 type.
Edit on GitHubAdded in 0.6.0
No other changes yet.
from "int8" include Int8
1s
-1s
Functions and constants included in the Int8 module.
Added in 0.6.0
No other changes yet.
fromNumber : (number: Number) => Int8
Converts a Number to an Int8.
Parameters:
| param | type | description |
|---|---|---|
number | Number | The value to convert |
number: The value to convertReturns:
| type | description |
|---|---|
Int8 | The Number represented as an Int8 |
Int8: The Number represented as an Int8Added in 0.6.0
No other changes yet.
toNumber : (value: Int8) => Number
Converts an Int8 to a Number.
Parameters:
| param | type | description |
|---|---|---|
value | Int8 | The value to convert |
value: The value to convertReturns:
| type | description |
|---|---|
Number | The Int8 represented as a Number |
Number: The Int8 represented as a NumberAdded in 0.6.0
No other changes yet.
fromUint8 : (number: Uint8) => Int8
Converts a Uint8 to an Int8.
Parameters:
| param | type | description |
|---|---|---|
number | Uint8 | The value to convert |
number: The value to convertReturns:
| type | description |
|---|---|
Int8 | The Uint8 represented as an Int8 |
Int8: The Uint8 represented as an Int8Examples:
Int8.fromUint8(1us) == 1s
Added in 0.6.0
No other changes yet.
incr : (value: Int8) => Int8
Increments the value by one.
Parameters:
| param | type | description |
|---|---|---|
value | Int8 | The value to increment |
value: The value to incrementReturns:
| type | description |
|---|---|
Int8 | The incremented value |
Int8: The incremented valueExamples:
Int8.incr(1s) == 2s
Int8.incr(-2s) == -1s
Added in 0.6.0
No other changes yet.
decr : (value: Int8) => Int8
Decrements the value by one.
Parameters:
| param | type | description |
|---|---|---|
value | Int8 | The value to decrement |
value: The value to decrementReturns:
| type | description |
|---|---|
Int8 | The decremented value |
Int8: The decremented valueExamples:
Int8.decr(2s) == 1s
Int8.decr(0s) == -1s
Added in 0.6.0
No other changes yet.
(+) : (x: Int8, y: Int8) => Int8
Computes the sum of its operands.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first operand |
y | Int8 | The second operand |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Int8 | The sum of the two operands |
Int8: The sum of the two operandsExamples:
use Int8.{ (+) }
assert 1s + 1s == 2s
Added in 0.6.0
No other changes yet.
(-) : (x: Int8, y: Int8) => Int8
Computes the difference of its operands.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first operand |
y | Int8 | The second operand |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Int8 | The difference of the two operands |
Int8: The difference of the two operandsExamples:
use Int8.{ (-) }
assert 2s - 1s == 1s
Added in 0.6.0
No other changes yet.
(*) : (x: Int8, y: Int8) => Int8
Computes the product of its operands.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first operand |
y | Int8 | The second operand |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Int8 | The product of the two operands |
Int8: The product of the two operandsExamples:
use Int8.{ (*) }
assert 2s * 2s == 4s
Added in 0.6.0
No other changes yet.
(/) : (x: Int8, y: Int8) => Int8
Computes the quotient of its operands using signed division.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first operand |
y | Int8 | The second operand |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Int8 | The quotient of its operands |
Int8: The quotient of its operandsExamples:
use Int8.{ (/) }
assert 8s / 2s == 4s
Added in 0.6.0
No other changes yet.
rem : (x: Int8, y: Int8) => Int8
Computes the remainder of the division of its operands using signed division.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first operand |
y | Int8 | The second operand |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Int8 | The remainder of its operands |
Int8: The remainder of its operandsExamples:
Int8.rem(8s, 3s) == 2s
Added in 0.6.0
No other changes yet.
(%) : (x: Int8, y: Int8) => Int8
Computes the remainder of the division of the first operand by the second. The result will have the sign of the second operand.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first operand |
y | Int8 | The second operand |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Int8 | The modulus of its operands |
Int8: The modulus of its operandsThrows:
ModuloByZero
- When
yis zero
Examples:
use Int8.{ (%) }
assert -5s % 3s == 1s
Added in 0.6.0
No other changes yet.
(<<) : (value: Int8, amount: Int8) => Int8
Shifts the bits of the value left by the given number of bits.
Parameters:
| param | type | description |
|---|---|---|
value | Int8 | The value to shift |
amount | Int8 | The number of bits to shift by |
value: The value to shiftamount: The number of bits to shift byReturns:
| type | description |
|---|---|
Int8 | The shifted value |
Int8: The shifted valueExamples:
use Int8.{ (<<) }
assert (5s << 1s) == 10s
Added in 0.6.0
No other changes yet.
(>>) : (value: Int8, amount: Int8) => Int8
Shifts the bits of the value right by the given number of bits, preserving the sign bit.
Parameters:
| param | type | description |
|---|---|---|
value | Int8 | The value to shift |
amount | Int8 | The amount to shift by |
value: The value to shiftamount: The amount to shift byReturns:
| type | description |
|---|---|
Int8 | The shifted value |
Int8: The shifted valueExamples:
use Int8.{ (>>) }
assert (5s >> 1s) == 2s
Added in 0.6.0
No other changes yet.
(==) : (x: Int8, y: Int8) => Bool
Checks if the first value is equal to the second value.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first value |
y | Int8 | The second value |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is equal to the second value or false otherwise |
Bool: true if the first value is equal to the second value or false otherwiseExamples:
use Int8.{ (==) }
assert 1s == 1s
Added in 0.6.0
No other changes yet.
(!=) : (x: Int8, y: Int8) => Bool
Checks if the first value is not equal to the second value.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first value |
y | Int8 | The second value |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is not equal to the second value or false otherwise |
Bool: true if the first value is not equal to the second value or false otherwiseExamples:
use Int8.{ (!=) }
assert 1s != 2s
Added in 0.6.0
No other changes yet.
(<) : (x: Int8, y: Int8) => Bool
Checks if the first value is less than the second value.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first value |
y | Int8 | The second value |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is less than the second value or false otherwise |
Bool: true if the first value is less than the second value or false otherwiseExamples:
use Int8.{ (<) }
assert 1s < 2s
Added in 0.6.0
No other changes yet.
(>) : (x: Int8, y: Int8) => Bool
Checks if the first value is greater than the second value.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first value |
y | Int8 | The second value |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is greater than the second value or false otherwise |
Bool: true if the first value is greater than the second value or false otherwiseExamples:
use Int8.{ (>) }
assert 2s > 1s
Added in 0.6.0
No other changes yet.
(<=) : (x: Int8, y: Int8) => Bool
Checks if the first value is less than or equal to the second value.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first value |
y | Int8 | The second value |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is less than or equal to the second value or false otherwise |
Bool: true if the first value is less than or equal to the second value or false otherwiseExamples:
use Int8.{ (<=) }
assert 1s <= 2s
use Int8.{ (<=) }
assert 1s <= 1s
Added in 0.6.0
No other changes yet.
(>=) : (x: Int8, y: Int8) => Bool
Checks if the first value is greater than or equal to the second value.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first value |
y | Int8 | The second value |
x: The first valuey: The second valueReturns:
| type | description |
|---|---|
Bool | true if the first value is greater than or equal to the second value or false otherwise |
Bool: true if the first value is greater than or equal to the second value or false otherwiseExamples:
use Int8.{ (>=) }
assert 2s >= 1s
use Int8.{ (>=) }
assert 1s >= 1s
Added in 0.6.0
No other changes yet.
lnot : (value: Int8) => Int8
Computes the bitwise NOT of the given value.
Parameters:
| param | type | description |
|---|---|---|
value | Int8 | The given value |
value: The given valueReturns:
| type | description |
|---|---|
Int8 | Containing the inverted bits of the given value |
Int8: Containing the inverted bits of the given valueExamples:
Int8.lnot(-5s) == 4s
Added in 0.6.0
No other changes yet.
(&) : (x: Int8, y: Int8) => Int8
Computes the bitwise AND (&) on the given operands.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first operand |
y | Int8 | The second operand |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Int8 | Containing a 1 in each bit position for which the corresponding bits of both operands are 1 |
Int8: Containing a 1 in each bit position for which the corresponding bits of both operands are 1Examples:
use Int8.{ (&) }
assert (3s & 4s) == 0s
Added in 0.6.0
No other changes yet.
(|) : (x: Int8, y: Int8) => Int8
Computes the bitwise OR (|) on the given operands.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first operand |
y | Int8 | The second operand |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Int8 | Containing a 1 in each bit position for which the corresponding bits of either or both operands are 1 |
Int8: Containing a 1 in each bit position for which the corresponding bits of either or both operands are 1Examples:
use Int8.{ (|) }
assert (3s | 4s) == 7s
Added in 0.6.0
No other changes yet.
(^) : (x: Int8, y: Int8) => Int8
Computes the bitwise XOR (^) on the given operands.
Parameters:
| param | type | description |
|---|---|---|
x | Int8 | The first operand |
y | Int8 | The second operand |
x: The first operandy: The second operandReturns:
| type | description |
|---|---|
Int8 | Containing a 1 in each bit position for which the corresponding bits of either but not both operands are 1 |
Int8: Containing a 1 in each bit position for which the corresponding bits of either but not both operands are 1Examples:
use Int8.{ (^) }
assert (3s ^ 5s) == 6s