shadow:standard

Interface Integer<T>

Interfaces

shadow:standard@Number<T>

interface Integer<T>

Interface Integer<T> specifies methods that any fixed-size integer representation of a number should have. This interface allows overloading of the &, |, and ^ binary operators as well as the ~ unary operator. If the & operator is applied, the appropriate bitAnd(T) method will be called. If the | operator is applied, the appropriate bitOr(T) method will be called. If the ^ operator is applied, the appropriate bitXor(T) method will be called. If the ~ operator is applied, the appropriate bitComplement(T) method will be called. The byte, code, int, long, short, ubyte, uint, ulong, and ushort types have this interface.

See Also

Method Summary

Modifiers Return Types Method and Description
public readonly (T) bitAnd(T other)

Method to compute the bitwise AND of the value and another T value.

public readonly (T) bitComplement()

Method to find the bitwise complement of the value.

public readonly (T) bitOr(T other)

Method to compute the bitwise OR of the value and another T value.

public readonly (T) bitRotateLeft(int amount)

Method to find the the result of left-rotating the bit representation by a signed amount which may be positive, negative, or zero.

public readonly (T) bitRotateLeft(uint amount)

Method to find the the result of left-rotating the bit representation.

public readonly (T) bitRotateRight(int amount)

Method to find the the result of right-rotating the bit representation by a signed amount which may be positive, negative, or zero.

public readonly (T) bitRotateRight(uint amount)

Method to find the the result of right-rotating the bit representation.

public readonly (T) bitShiftLeft(int amount)

Method to find the the result of left-shifting the bit representation by a signed amount which may be positive, negative, or zero.

public readonly (T) bitShiftLeft(uint amount)

Method to find the the result of left-shifting the bit representation.

public readonly (T) bitShiftRight(int amount)

Method to find the the result of right-shifting the bit representation by a signed amount which may be positive, negative, or zero.

public readonly (T) bitShiftRight(uint amount)

Method to find the the result of right-shifting the bit representation.

public readonly (T) bitXor(T other)

Method to compute the bitwise XOR of the value and another T value.

Method Detail

bitAnd

public readonly bitAnd(T other) => (T)

Method to compute the bitwise AND of the value and another T value.

Parameters

other - value to bitwise AND with

Returns

result of bitwise AND

bitComplement

public readonly bitComplement() => (T)

Method to find the bitwise complement of the value.

Returns

bitwise complement

bitOr

public readonly bitOr(T other) => (T)

Method to compute the bitwise OR of the value and another T value.

Parameters

other - value to bitwise OR with

Returns

result of bitwise OR

bitRotateLeft

public readonly bitRotateLeft(int amount) => (T)

Method to find the the result of left-rotating the bit representation by a signed amount which may be positive, negative, or zero.

Parameters

amount - bits to rotate

Returns

rotated value

bitRotateLeft

public readonly bitRotateLeft(uint amount) => (T)

Method to find the the result of left-rotating the bit representation.

Parameters

amount - bits to rotate

Returns

rotated value

bitRotateRight

public readonly bitRotateRight(int amount) => (T)

Method to find the the result of right-rotating the bit representation by a signed amount which may be positive, negative, or zero.

Parameters

amount - bits to rotate

Returns

rotated value

bitRotateRight

public readonly bitRotateRight(uint amount) => (T)

Method to find the the result of right-rotating the bit representation.

Parameters

amount - bits to rotate

Returns

rotated value

bitShiftLeft

public readonly bitShiftLeft(int amount) => (T)

Method to find the the result of left-shifting the bit representation by a signed amount which may be positive, negative, or zero.

Parameters

amount - bits to shift

Returns

shifted value

bitShiftLeft

public readonly bitShiftLeft(uint amount) => (T)

Method to find the the result of left-shifting the bit representation.

Parameters

amount - bits to shift

Returns

shifted value

bitShiftRight

public readonly bitShiftRight(int amount) => (T)

Method to find the the result of right-shifting the bit representation by a signed amount which may be positive, negative, or zero.

Parameters

amount - bits to shift

Returns

shifted value

bitShiftRight

public readonly bitShiftRight(uint amount) => (T)

Method to find the the result of right-shifting the bit representation.

Parameters

amount - bits to shift

Returns

shifted value

bitXor

public readonly bitXor(T other) => (T)

Method to compute the bitwise XOR of the value and another T value.

Parameters

other - value to bitwise XOR with

Returns

result of bitwise XOR