[PATCH] include: introduce byte counting macros.
Aaron Plattner
aplattner at freedesktop.org
Tue Jun 16 09:07:10 PDT 2009
On Tue, Jun 16, 2009 at 03:40:56AM -0700, Matthias Hopf wrote:
> On Jun 16, 09 10:56:39 +1000, Peter Hutterer wrote:
> > This patch adds the following three macros:
> > count_bytes(bits) - the number of bytes needed to hold 'bits'
> > count_4byte_units(bytes) - the number of 4-byte units to hold 'bytes'
> > pad_to_4(bytes) - the closest multiple of 4 equal to or larger than 'bytes'.
>
> Generally I like abstraction like this.
> I only have few minor comments:
>
> - Macros should consist of capital letters - for a reason.
> They tend to behave weird if the arguments are lvalues with side
> effects (like i++). That said, these macros are save.
Are static inline functions sufficiently portable for use here?
They're pretty much better in every way.
More information about the xorg-devel
mailing list