Bit operations
Function: ModifyBit (Setting by bit position)
Description:
Modifies a specific bit in a byte value based on its position.
Parameters:
- value
: The byte value to be modified.
- bit
: Position of the bit to be modified (0-based index).
- set
: If true
, the specified bit is set to 1; if false
, it's set to 0.
Return Value:
Returns the modified byte value.
Usage Example | |
---|---|
Function: ModifyBit (Setting by mask)
Description:
Sets bits in a byte value using a mask.
Parameters:
- value
: The byte value to be modified.
- valueToSet
: The byte value that contains bits to be set.
- mask
: The mask that indicates which bits in the original byte should be modified.
Return Value:
Returns the modified byte value.
Usage Example | |
---|---|
Function: ApplyMask
Description:
Applies a mask to a byte value.
Parameters:
- value
: The byte value.
- mask
: The mask to be applied.
Return Value:
Returns the byte value after the mask has been applied.
Usage Example | |
---|---|
Function: TestBit
Description:
Tests if a specific bit in a byte value is set.
Parameters:
- value
: The byte value.
- bit
: Position of the bit to be tested (0-based index).
Return Value:
Returns true
if the specified bit is set, otherwise false
.