JÃrÃme Duval wrote: > 2012/11/6 Ingo Weinhold <ingo_weinhold@xxxxxx> > > > > Here the check is necessary indeed. On the other hand all the shifts > > are > > > > the wrong way around. I wonder why I didn't use a mask for the > > boundary, > > > > anyway. The checks would be similiar, but a mask doesn't need a loop > > to be > > > > computed. > > > > > > Right. You think to something like ((offsetStart ^ (offsetStart + length > > - > > > 1)) & ~(boundary - 1)) == 0 ? > > > > I was thinking of > > > > boundaryMask = -boundary; > > > > in the initialization part. And then check ((offsetStart | (offsetStart + > > length - 1)) & boundaryMask) != 0. > > This doesn't work right IMO. Yeah, not sure what I was thinking. > Moreover boundaryMask would be a int32? No, a page_num_t. -boundary is just a simpler way of writing ~(boundary - 1). > I still like my proposition above :) Me too. I'd just move the computation of the mask out of the loop. CU, Ingo