Int32

GitHub   Edit on GitHub

Utilities for working with the Int32 type.

Added in 0.2.0 No other changes yet.
1
from "int32" include Int32

Values

Functions and constants included in the Int32 module.

Int32.fromNumber

Added in 0.2.0 No other changes yet.
1
fromNumber : (number: Number) => Int32

Converts a Number to an Int32.

Parameters:

param type description
number Number The value to convert

Returns:

type description
Int32 The Number represented as an Int32

Int32.toNumber

Added in 0.2.0 No other changes yet.
1
toNumber : (value: Int32) => Number

Converts an Int32 to a Number.

Parameters:

param type description
value Int32 The value to convert

Returns:

type description
Number The Int32 represented as a Number

Int32.fromUint32

Added in 0.6.0 No other changes yet.
1
fromUint32 : (number: Uint32) => Int32

Converts a Uint32 to an Int32.

Parameters:

param type description
number Uint32 The value to convert

Returns:

type description
Int32 The Uint32 represented as an Int32

Int32.incr

Added in 0.2.0 No other changes yet.
1
incr : (value: Int32) => Int32

Increments the value by one.

Parameters:

param type description
value Int32 The value to increment

Returns:

type description
Int32 The incremented value

Int32.decr

Added in 0.2.0 No other changes yet.
1
decr : (value: Int32) => Int32

Decrements the value by one.

Parameters:

param type description
value Int32 The value to decrement

Returns:

type description
Int32 The decremented value

Int32.(+)

Added in 0.6.0
versionchanges
0.2.0Originally named `add`
1
(+) : (x: Int32, y: Int32) => Int32

Computes the sum of its operands.

Parameters:

param type description
x Int32 The first operand
y Int32 The second operand

Returns:

type description
Int32 The sum of the two operands

Int32.(-)

Added in 0.6.0
versionchanges
0.2.0Originally named `sub`
1
(-) : (x: Int32, y: Int32) => Int32

Computes the difference of its operands.

Parameters:

param type description
x Int32 The first operand
y Int32 The second operand

Returns:

type description
Int32 The difference of the two operands

Int32.(*)

Added in 0.6.0
versionchanges
0.2.0Originally named `mul`
1
(*) : (x: Int32, y: Int32) => Int32

Computes the product of its operands.

Parameters:

param type description
x Int32 The first operand
y Int32 The second operand

Returns:

type description
Int32 The product of the two operands

Int32.(/)

Added in 0.6.0
versionchanges
0.2.0Originally named `div`
1
(/) : (x: Int32, y: Int32) => Int32

Computes the quotient of its operands using signed division.

Parameters:

param type description
x Int32 The first operand
y Int32 The second operand

Returns:

type description
Int32 The quotient of its operands

Int32.rem

Added in 0.2.0 No other changes yet.
1
rem : (x: Int32, y: Int32) => Int32

Computes the remainder of the division of its operands using signed division.

Parameters:

param type description
x Int32 The first operand
y Int32 The second operand

Returns:

type description
Int32 The remainder of its operands

Int32.(%)

Added in 0.6.0
versionchanges
0.2.0Originally named `mod`
1
(%) : (x: Int32, y: Int32) => Int32

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 Int32 The first operand
y Int32 The second operand

Returns:

type description
Int32 The modulus of its operands

Throws:

ModuloByZero

  • When y is zero

Int32.rotl

Added in 0.4.0 No other changes yet.
1
rotl : (value: Int32, amount: Int32) => Int32

Rotates the bits of the value left by the given number of bits.

Parameters:

param type description
value Int32 The value to rotate
amount Int32 The number of bits to rotate by

Returns:

type description
Int32 The rotated value

Int32.rotr

Added in 0.4.0 No other changes yet.
1
rotr : (value: Int32, amount: Int32) => Int32

Rotates the bits of the value right by the given number of bits.

Parameters:

param type description
value Int32 The value to rotate
amount Int32 The number of bits to rotate by

Returns:

type description
Int32 The rotated value

Int32.(<<)

Added in 0.6.0
versionchanges
0.2.0Originally named `shl`
1
(<<) : (value: Int32, amount: Int32) => Int32

Shifts the bits of the value left by the given number of bits.

Parameters:

param type description
value Int32 The value to shift
amount Int32 The number of bits to shift by

Returns:

type description
Int32 The shifted value

Int32.(>>)

Added in 0.6.0
versionchanges
0.2.0Originally named `shr`
1
(>>) : (value: Int32, amount: Int32) => Int32

Shifts the bits of the value right by the given number of bits, preserving the sign bit.

Parameters:

param type description
value Int32 The value to shift
amount Int32 The amount to shift by

Returns:

type description
Int32 The shifted value

Int32.(==)

Added in 0.6.0
versionchanges
0.4.0Originally named `eq`
1
(==) : (x: Int32, y: Int32) => Bool

Checks if the first value is equal to the second value.

Parameters:

param type description
x Int32 The first value
y Int32 The second value

Returns:

type description
Bool true if the first value is equal to the second value or false otherwise

Int32.(!=)

Added in 0.6.0
versionchanges
0.4.0Originally named `ne`
1
(!=) : (x: Int32, y: Int32) => Bool

Checks if the first value is not equal to the second value.

Parameters:

param type description
x Int32 The first value
y Int32 The second value

Returns:

type description
Bool true if the first value is not equal to the second value or false otherwise

Int32.eqz

Added in 0.4.0 No other changes yet.
1
eqz : (value: Int32) => Bool

Checks if the given value is equal to zero.

Parameters:

param type description
value Int32 The value to inspect

Returns:

type description
Bool true if the first value is equal to zero or false otherwise

Int32.(<)

Added in 0.6.0
versionchanges
0.2.0Originally named `lt`
1
(<) : (x: Int32, y: Int32) => Bool

Checks if the first value is less than the second value.

Parameters:

param type description
x Int32 The first value
y Int32 The second value

Returns:

type description
Bool true if the first value is less than the second value or false otherwise

Int32.(>)

Added in 0.6.0
versionchanges
0.2.0Originally named `gt`
1
(>) : (x: Int32, y: Int32) => Bool

Checks if the first value is greater than the second value.

Parameters:

param type description
x Int32 The first value
y Int32 The second value

Returns:

type description
Bool true if the first value is greater than the second value or false otherwise

Int32.(<=)

Added in 0.6.0
versionchanges
0.2.0Originally named `lte`
1
(<=) : (x: Int32, y: Int32) => Bool

Checks if the first value is less than or equal to the second value.

Parameters:

param type description
x Int32 The first value
y Int32 The second value

Returns:

type description
Bool true if the first value is less than or equal to the second value or false otherwise

Int32.(>=)

Added in 0.6.0
versionchanges
0.2.0Originally named `gte`
1
(>=) : (x: Int32, y: Int32) => Bool

Checks if the first value is greater than or equal to the second value.

Parameters:

param type description
x Int32 The first value
y Int32 The second value

Returns:

type description
Bool true if the first value is greater than or equal to the second value or false otherwise

Int32.lnot

Added in 0.2.0 No other changes yet.
1
lnot : (value: Int32) => Int32

Computes the bitwise NOT of the given value.

Parameters:

param type description
value Int32 The given value

Returns:

type description
Int32 Containing the inverted bits of the given value

Int32.(&)

Added in 0.6.0
versionchanges
0.2.0Originally named `land`
1
(&) : (x: Int32, y: Int32) => Int32

Computes the bitwise AND (&) on the given operands.

Parameters:

param type description
x Int32 The first operand
y Int32 The second operand

Returns:

type description
Int32 Containing a 1 in each bit position for which the corresponding bits of both operands are 1

Int32.(|)

Added in 0.6.0
versionchanges
0.2.0Originally named `lor`
1
(|) : (x: Int32, y: Int32) => Int32

Computes the bitwise OR (|) on the given operands.

Parameters:

param type description
x Int32 The first operand
y Int32 The second operand

Returns:

type description
Int32 Containing a 1 in each bit position for which the corresponding bits of either or both operands are 1

Int32.(^)

Added in 0.6.0
versionchanges
0.2.0Originally named `lxor`
1
(^) : (x: Int32, y: Int32) => Int32

Computes the bitwise XOR (^) on the given operands.

Parameters:

param type description
x Int32 The first operand
y Int32 The second operand

Returns:

type description
Int32 Containing a 1 in each bit position for which the corresponding bits of either but not both operands are 1

Int32.clz

Added in 0.4.0 No other changes yet.
1
clz : (value: Int32) => Int32

Counts the number of leading zero bits in the value.

Parameters:

param type description
value Int32 The value to inspect

Returns:

type description
Int32 The amount of leading zeros

Int32.ctz

Added in 0.4.0 No other changes yet.
1
ctz : (value: Int32) => Int32

Counts the number of trailing zero bits in the value.

Parameters:

param type description
value Int32 The value to inspect

Returns:

type description
Int32 The amount of trailing zeros

Int32.popcnt

Added in 0.4.0 No other changes yet.
1
popcnt : (value: Int32) => Int32

Counts the number of bits set to 1 in the value, also known as a population count.

Parameters:

param type description
value Int32 The value to inspect

Returns:

type description
Int32 The amount of 1-bits in its operand

Int32.(**)

Added in 0.6.0 No other changes yet.
1
(**) : (base: Int32, power: Int32) => Int32

Computes the exponentiation of the given base and power.

Parameters:

param type description
base Int32 The base number
power Int32 The exponent number

Returns:

type description
Int32 The base raised to the given power
This is a notification!