bit
Module with some bits utility functions.
- class BitUtils
Bases:
object
Class container for bit utility functions.
- static IsBitSet(value: int, bit_num: int) bool
Get if the specified bit is set.
- Parameters:
value (int) – Value
bit_num (int) – Bit number to check
- Returns:
True if bit is set, false otherwise
- Return type:
bool
- static AreBitsSet(value: int, bit_mask: int) bool
Get if the specified bits are set.
- Parameters:
value (int) – Value
bit_mask (int) – Bit mask to check
- Returns:
True if bit is set, false otherwise
- Return type:
bool
- static SetBit(value: int, bit_num: int) int
Set the specified bit.
- Parameters:
value (int) – Value
bit_num (int) – Bit number to set
- Returns:
Value with the specified bit set
- Return type:
int
- static SetBits(value: int, bit_mask: int) int
Set the specified bits.
- Parameters:
value (int) – Value
bit_mask (int) – Bit mask to set
- Returns:
Value with the specified bit set
- Return type:
int
- static ResetBit(value: int, bit_num: int) int
Reset the specified bit.
- Parameters:
value (int) – Value
bit_num (int) – Bit number to reset
- Returns:
Value with the specified bit reset
- Return type:
int
- static ResetBits(value: int, bit_mask: int) int
Reset the specified bits.
- Parameters:
value (int) – Value
bit_mask (int) – Bit mask to reset
- Returns:
Value with the specified bit reset
- Return type:
int