C Programming - Rounding Up

An unsigned integer x can be rounded up to the next greater multiple of 8 with either of

(x + 7) & -8
x + (-x & 7)

Labels:


About this entry