[haiku-commits] Re: haiku: hrev44773 - src/system/kernel/vm

  • From: Jérôme Duval <korli@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 6 Nov 2012 19:39:43 +0100

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. Moreover boundaryMask would be a int32? I
still like my proposition above :)

Bye,
Jérôme

Other related posts: