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