> m = (~m) & ~((~m)-1); Doh. ~((~m)-1) is just m+1, so this can be simplified to m = (m + 1) & ~m; /~\ The ASCII Mouse \ / Ribbon Campaign X Against HTML mouse%rodents-montreal.org@localhost / \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B