| Index: cc/base/util.h
|
| diff --git a/cc/base/util.h b/cc/base/util.h
|
| index 1d716ae2a42f4b4d25f1bf38e6fb38a4a9c806a3..60c5093f400d16a4e2f5137435f6e63c954bfc3d 100644
|
| --- a/cc/base/util.h
|
| +++ b/cc/base/util.h
|
| @@ -9,6 +9,17 @@
|
|
|
| #include "base/basictypes.h"
|
|
|
| +// Declares an enum for which the values can be used to index an array.
|
| +// In addition to the enum, this also declares 3 constants. enumname_MIN,
|
| +// enumname_MAX and enumname_ARRAYSIZE. The last can be used to declare
|
| +// an array that is large enough to allow indexing using all enum values.
|
| +#define DEFINE_ENUM(name, ...) \
|
| + enum name { __VA_ARGS__ }; \
|
| + const name name ## _MIN = static_cast<name>(0); \
|
| + const name name ## _MAX = static_cast<name>( \
|
| + sizeof((int[]) { __VA_ARGS__ }) / sizeof(name ## _MIN) - 1); \
|
| + const int name ## _ARRAYSIZE = name ## _MAX + 1
|
| +
|
| namespace cc {
|
|
|
| template <typename T> T RoundUp(T n, T mul) {
|
|
|