int x = n / 3; // <-- make this faster // for instance int a = n * 3; // <-- normal integer multiplication int b = (n << 1) + n; // <-- potentiall
A lookup table approach would also be faster in some architectures.
uint8_t DivBy3LU(uint8_t u8Operand) { uint8_t ai8Div3 = [0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, ....]; return ai8Div3[u8Operand]; }