[ros-dev] Re: [ros-svn] [gvg] 13584: Fix ROUND_UP when N is a
multiple of S. Proposed by unC0Rr.
Ge van Geldorp
gvg at reactos.com
Tue Feb 15 20:30:46 CET 2005
> From: Hartmut Birr
> I don't like this implemention (and the old one) of ROUND_UP and
> ROUND_DOWN. I would prefer:
> #define ROUND_UP(N,S) (((N) + (S) -1) & ~((S) -1))
> #define ROUND_DOWN(N,S) ((N) & ~((S) - 1))
The change was a result of a little discussion we had on IRC about the
definitions you propose only being valid for S being a power of 2. During
the discussion, we noticed that the old ROUND_DOWN definition was wrong.
In binhive.c, the macros are only called with S being a power of 2, so we
can use the definitions you propose. I've changed them.
Gé van Geldorp.
More information about the Ros-dev