performance of unsigned vs signed integers
Division by powers of 2 is faster with unsigned int, because it can be optimized into a single shift instruction. With signed int, it usually requires more machine instructions, because division rounds towards zero, but shifting to the right rounds down. Example: int foo(int x, unsigned y) { x /= 8; y /= 8; return … Read more