On Sunday 22 April 2007 14:08, Uri Guttman wrote:

> >>>>> "JP" == Joerg Plate <[EMAIL PROTECTED]> writes:
>   >>
>   >> const int slot = (reg_alloc + 7) >> 3; reg_alloc = slot << 3;
>   >>
>   >> This is where I start not to understand.  Why reg_alloc + 7? Why
>   >> shift left and right by 3?
>
>   JP> That's just a rounding up (if necessary) to a multiple of 8 (2<<3).
>
> and those sort of things should be macros as they are confusing
> otherwise and annoying to change. and named something like
> ROUND_UP_TO_BOUNDARY. as others have said it is a common idiom. and i
> agree that there should be comments on WHY the rounding is used/needed.

I figured it was a rounding, but I saw two magic numbers and didn't want to 
guess what it was.

Any volunteers to macroize this?

Also, is anyone *sure* that this boundary is effective on both 32- and 64-bit 
platforms?  I hate to make assumptions about alignment.

-- c

Reply via email to