Alignment helper
offset
alignment
int alignTo(int offset, int alignment) { return (offset + alignment - 1) & ~(alignment - 1); }