Sets the value of a concrete bit into a bitarray to 0 or 1
void cpct_setBit (void* array, u16 index, u8 value)
(2B DE) array | Pointer to the first byte of the array |
(2B HL) index | Position of the bit in the array to be modified |
(1B C ) value | New value {0, 1} for the bit at the given position |
call cpct_setBit_asm
Set the new value of the bit at the given position (index) in the specified array. This function assumes that the array elements have a size of 8 bits and also that the given index is not bigger than the number of bits in the array (size of the array multiplied by 8). The value to be set is also assumed to be 0 or 1, but other values will “work” (just the least significant bit will be used, so odd values are treated as 1, even vales as 0).
AF, BC, DE, HL
52 bytes (8 bytes bitWeights table, 43 bytes code)
Case | Cycles | microSecs (us) ------------------------------- Best (1) | 229 | 57.25 ------------------------------- Worst (0) | 240 | 60.00 ------------------------------- Asm saving | -84 | -21.00 -------------------------------