| Index: base/compiler_specific.h
|
| diff --git a/base/compiler_specific.h b/base/compiler_specific.h
|
| index 0d9346096e87ba49435b6378d3408676dcb2ff9d..9e65ae4d4824d0e1ddccb206e8113949daf33fe8 100644
|
| --- a/base/compiler_specific.h
|
| +++ b/base/compiler_specific.h
|
| @@ -105,6 +105,25 @@
|
| #define NOINLINE
|
| #endif
|
|
|
| +// Specify memory alignment for structs, classes, etc.
|
| +// Use like:
|
| +// class ALIGNAS(16) MyClass { ... }
|
| +// ALIGNAS(16) int array[4];
|
| +#if defined(COMPILER_MSVC)
|
| +#define ALIGNAS(byte_alignment) __declspec(align(byte_alignment))
|
| +#elif defined(COMPILER_GCC)
|
| +#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment)))
|
| +#endif
|
| +
|
| +// Return the byte alignment of the given type (available at compile time).
|
| +// Use like:
|
| +// ALIGNOF(int32) // this would be 4
|
| +#if defined(COMPILER_MSVC)
|
| +#define ALIGNOF(type) __alignof(type)
|
| +#elif defined(COMPILER_GCC)
|
| +#define ALIGNOF(type) __alignof__(type)
|
| +#endif
|
| +
|
| // Annotate a virtual method indicating it must be overriding a virtual
|
| // method in the parent class.
|
| // Use like:
|
|
|