On Mon, 11 Jun 2012 09:07:19 -0600, Brian Paul <bri...@vmware.com> wrote: > On 06/11/2012 12:59 AM, Pauli Nieminen wrote: > > diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h > > index d1df2ce..e05fa14 100644 > > --- a/src/mesa/main/macros.h > > +++ b/src/mesa/main/macros.h > > @@ -679,5 +679,8 @@ do { \ > > #define ENUM_TO_DOUBLE(E) ((GLdouble)(GLint)(E)) > > #define ENUM_TO_BOOLEAN(E) ((E) ? GL_TRUE : GL_FALSE) > > > > +#ifndef ARRAY_SIZE > > +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) > > +#endif > > > > #endif > > > Core Mesa uses the Element() macro for this, defined in compiler.h. > We should just use one or the other. I'd go with just using Element() > everywhere for now to avoid churn.
On the other hand, ARRAY_SIZE is the macro from the linux kernel, which we also use in libdrm and the 2d driver and most of piglit. It's nice to be able to type the same thing across the driver project. It's also very clear what it does, unlike a macro named Elements in vbo-related code which makes me think of vertex elements. But I'm fine with Mesa core continuing with Elements to avoid churn.
pgphwayqagwy4.pgp
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev