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.
Modifiers | Return Types | Method and Description |
---|---|---|
public readonly |
(T) |
bitAnd(T other) Method to compute the bitwise AND of the value and another |
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 |
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 |
public readonly bitAnd(T other) => (T)
Method to compute the bitwise AND of the value and another T
value.
other
- value to bitwise AND with
result of bitwise AND
public readonly bitComplement() => (T)
Method to find the bitwise complement of the value.
bitwise complement
public readonly bitOr(T other) => (T)
Method to compute the bitwise OR of the value and another T
value.
other
- value to bitwise OR with
result of bitwise OR
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.
amount
- bits to rotate
rotated value
public readonly bitRotateLeft(uint amount) => (T)
Method to find the the result of left-rotating the bit representation.
amount
- bits to rotate
rotated value
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.
amount
- bits to rotate
rotated value
public readonly bitRotateRight(uint amount) => (T)
Method to find the the result of right-rotating the bit representation.
amount
- bits to rotate
rotated value
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.
amount
- bits to shift
shifted value
public readonly bitShiftLeft(uint amount) => (T)
Method to find the the result of left-shifting the bit representation.
amount
- bits to shift
shifted value
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.
amount
- bits to shift
shifted value
public readonly bitShiftRight(uint amount) => (T)
Method to find the the result of right-shifting the bit representation.
amount
- bits to shift
shifted value
public readonly bitXor(T other) => (T)
Method to compute the bitwise XOR of the value and another T
value.
other
- value to bitwise XOR with
result of bitwise XOR