| Index: src/base/macros.h
|
| diff --git a/src/base/macros.h b/src/base/macros.h
|
| index 736a656ed9f11e09ce217a6bf7b4a479f0b034d9..381107b8603bdd9ca51c47e4b52a286f8d7c8b44 100644
|
| --- a/src/base/macros.h
|
| +++ b/src/base/macros.h
|
| @@ -6,6 +6,7 @@
|
| #define V8_BASE_MACROS_H_
|
|
|
| #include "include/v8stdint.h"
|
| +#include "src/base/build_config.h"
|
|
|
|
|
| // The expression OFFSET_OF(type, field) computes the byte-offset
|
| @@ -112,6 +113,52 @@ inline void USE(T) { }
|
|
|
| #define IS_POWER_OF_TWO(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
|
|
|
| +
|
| +// Define our own macros for writing 64-bit constants. This is less fragile
|
| +// than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it
|
| +// works on compilers that don't have it (like MSVC).
|
| +#if V8_CC_MSVC
|
| +# define V8_UINT64_C(x) (x ## UI64)
|
| +# define V8_INT64_C(x) (x ## I64)
|
| +# if V8_HOST_ARCH_64_BIT
|
| +# define V8_INTPTR_C(x) (x ## I64)
|
| +# define V8_PTR_PREFIX "ll"
|
| +# else
|
| +# define V8_INTPTR_C(x) (x)
|
| +# define V8_PTR_PREFIX ""
|
| +# endif // V8_HOST_ARCH_64_BIT
|
| +#elif V8_CC_MINGW64
|
| +# define V8_UINT64_C(x) (x ## ULL)
|
| +# define V8_INT64_C(x) (x ## LL)
|
| +# define V8_INTPTR_C(x) (x ## LL)
|
| +# define V8_PTR_PREFIX "I64"
|
| +#elif V8_HOST_ARCH_64_BIT
|
| +# if V8_OS_MACOSX
|
| +# define V8_UINT64_C(x) (x ## ULL)
|
| +# define V8_INT64_C(x) (x ## LL)
|
| +# else
|
| +# define V8_UINT64_C(x) (x ## UL)
|
| +# define V8_INT64_C(x) (x ## L)
|
| +# endif
|
| +# define V8_INTPTR_C(x) (x ## L)
|
| +# define V8_PTR_PREFIX "l"
|
| +#else
|
| +# define V8_UINT64_C(x) (x ## ULL)
|
| +# define V8_INT64_C(x) (x ## LL)
|
| +# define V8_INTPTR_C(x) (x)
|
| +# define V8_PTR_PREFIX ""
|
| +#endif
|
| +
|
| +#define V8PRIxPTR V8_PTR_PREFIX "x"
|
| +#define V8PRIdPTR V8_PTR_PREFIX "d"
|
| +#define V8PRIuPTR V8_PTR_PREFIX "u"
|
| +
|
| +// Fix for Mac OS X defining uintptr_t as "unsigned long":
|
| +#if V8_OS_MACOSX
|
| +#undef V8PRIxPTR
|
| +#define V8PRIxPTR "lx"
|
| +#endif
|
| +
|
| // The following macro works on both 32 and 64-bit platforms.
|
| // Usage: instead of writing 0x1234567890123456
|
| // write V8_2PART_UINT64_C(0x12345678,90123456);
|
|
|