Int32

0.40.0

Definitions

def abs ( x : Int32 ) : Int32 \ Pure

Source

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

def bitCount ( x : Int32 ) : Int32 \ Pure

Source

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

def bitwiseAnd ( x : Int32 y : Int32 ) : Int32 \ Pure

Source

Returns the bitwise AND of x and y.

def bitwiseNot ( x : Int32 ) : Int32 \ Pure

Source

Returns the bitwise NOT of x.

def bitwiseOr ( x : Int32 y : Int32 ) : Int32 \ Pure

Source

Returns the bitwise OR of x and y.

def bitwiseXor ( x : Int32 y : Int32 ) : Int32 \ Pure

Source

Returns the bitwise XOR of x and y.

def clampToInt16 ( min : { min = Int16 } max : { max = Int16 } x : Int32 ) : Int16 \ Pure

Source

Convert x to an Int16.

Returns x clamped within the Int16 range min to max.

def clampToInt8 ( min : { min = Int8 } max : { max = Int8 } x : Int32 ) : Int8 \ Pure

Source

Convert x to an Int8.

Returns x clamped within the Int8 range min to max.

def clearBit ( pos : { pos = Int32 } x : Int32 ) : Int32 \ Pure

Source

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) - 31 (leftmost bit)

def compare ( x : Int32 y : Int32 ) : Int32 \ Pure

Source

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

def dist ( x : Int32 y : Int32 ) : Int32 \ Pure

Source

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

def factorial ( x : Int32 ) : Int32 \ Pure

Source

Returns the factorial of x. If the given value is negative, 0 is returned.

def flipBit ( pos : { pos = Int32 } x : Int32 ) : Int32 \ Pure

Source

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) - 31 (leftmost bit)

def fromString ( s : String ) : Option[Int32] \ Pure

Source

Parse the string s as an Int32, 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 : Int32 ) : Int32 \ Pure

Source

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

def highestOneBit ( x : Int32 ) : Int32 \ Pure

Source

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 : Int32 ) : Int32 \ Pure

Source

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

def leftShift ( x : Int32 y : Int32 ) : Int32 \ Pure

Source

Returns x with the bits shifted left by y places

def log2 ( x : Int32 ) : Int32 \ Pure

Source

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

def logicalRightShift ( dist : { dist = Int32 } x : Int32 ) : Int32 \ Pure

Source

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

def lowestOneBit ( x : Int32 ) : Int32 \ Pure

Source

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 : Int32 ) : Int32 \ Pure

Source

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

def max ( x : Int32 y : Int32 ) : Int32 \ Pure

Source

Returns the larger of x and y.

def maxValue : Int32 \ Pure

Source

Returns the maximum number representable by an Int32.

def min ( x : Int32 y : Int32 ) : Int32 \ Pure

Source

Returns the smaller of x and y.

def minValue : Int32 \ Pure

Source

Returns the minimum number representable by an Int32.

def mod ( x : Int32 n : Int32 ) : Int32 \ Pure

Source

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

def numberOfLeadingZeros ( x : Int32 ) : Int32 \ Pure

Source

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

def numberOfTrailingZeros ( x : Int32 ) : Int32 \ Pure

Source

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

def parse ( radix : Int32 s : String ) : Result[String, Int32] \ Pure

Source

Parse the string s as an Int32, where the radix is used while parsing. Leading or trailing whitespace is trimmed. A successful parse is wrapped with Ok(x), a parse failure is indicated by Err(_).

def pow ( b : Int32 n : Int32 ) : Int32 \ Pure

Source

Returns b raised to the power of n.

def rem ( x : Int32 n : Int32 ) : Int32 \ Pure

Source

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

See also Int32.mod.

def reverse ( x : Int32 ) : Int32 \ Pure

Source

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

def rightShift ( x : Int32 y : Int32 ) : Int32 \ Pure

Source

Returns x with the bits shifted right by y places

def rotateLeft ( dist : { dist = Int32 } x : Int32 ) : Int32 \ Pure

Source

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

def rotateRight ( dist : { dist = Int32 } x : Int32 ) : Int32 \ Pure

Source

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

def setBit ( pos : { pos = Int32 } x : Int32 ) : Int32 \ Pure

Source

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) - 31 (leftmost bit)

def signum ( x : Int32 ) : Int32 \ Pure

Source

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

def size : Int32 \ Pure

Source

Returns the number of bits used to represent an Int32.

def toBigDecimal ( x : Int32 ) : BigDecimal \ Pure

Source

Convert x to a BigDecimal.

The numeric value of x is preserved exactly.

def toBigInt ( x : Int32 ) : BigInt \ Pure

Source

Convert x to a BigInt.

The numeric value of x is preserved exactly.

def toFloat32 ( x : Int32 ) : Float32 \ Pure

Source

Convert x to an Float32.

The numeric value of x may lose precision.

def toFloat64 ( x : Int32 ) : Float64 \ Pure

Source

Convert x to a Float64.

The numeric value of x is preserved exactly.

def toInt64 ( x : Int32 ) : Int64 \ Pure

Source

Convert x to a Int64.

The numeric value of x is preserved exactly.

def toString ( x : Int32 ) : String \ Pure

Source

Return a string representation of x.

def tryToInt16 ( x : Int32 ) : Option[Int16] \ Pure

Source

Convert x to an Option[Int16].

Returns Some(x as Int16) if the numeric value of x can be represented exactly.

Returns None if the numeric value of x is outside the range of Int16 (i.e. -32768 to 32767).

def tryToInt8 ( x : Int32 ) : Option[Int8] \ Pure

Source

Convert x to an Option[Int8].

Returns Some(x as Int8) if the numeric value of x can be represented exactly.

Returns None if the numeric value of x is outside the range of Int8 (i.e. -128 to 127).