Pages

2011-07-30

Align to x

Simple method to achieve that:
a = (a + (x-1)) & ~(x-1)


For example, align to 16:
a = (a + 15) & ~15
U know why :)

No comments:

Post a Comment