I'm playing around with timing delays and am using an 8 bit version of millis() by calling a function which returns millis() truncated to 8 bits.
My variables are all 8bit, unsigned integers.
However, when I do math within a "while" statement or "if" statement, the value returned is sometimes negative (because the adding or subtracting is done at a higher bit depth). I assume the math is done at 32 bits.
Obviously it's an easy workaround to create another 8 bit variable, and a couple more lines of code, to handle the rollover correctly. But in the interest of speed, and using fewer variables, is there a simple way to specify that math (adding and subtracting) should be done at 8 bits only, (or any other desired number of bits)?