Author: [email protected]
Date: Tue May 5 03:21:28 2009
New Revision: 1861
Modified:
branches/bleeding_edge/include/v8.h
branches/bleeding_edge/src/globals.h
Log:
Use our own macros for 64-bit constants.
Review URL: http://codereview.chromium.org/109017
Modified: branches/bleeding_edge/include/v8.h
==============================================================================
--- branches/bleeding_edge/include/v8.h (original)
+++ branches/bleeding_edge/include/v8.h Tue May 5 03:21:28 2009
@@ -77,9 +77,7 @@
#endif // BUILDING_V8_SHARED
#else // _WIN32
-#ifndef __STDC_CONSTANT_MACROS
-#define __STDC_CONSTANT_MACROS
-#endif
+
#include <stdint.h>
// Setup for Linux shared library export. There is no need to destinguish
Modified: branches/bleeding_edge/src/globals.h
==============================================================================
--- branches/bleeding_edge/src/globals.h (original)
+++ branches/bleeding_edge/src/globals.h Tue May 5 03:21:28 2009
@@ -50,10 +50,15 @@
typedef uint8_t byte;
typedef byte* Address;
-// Define macros for writing 64-bit constants and pointer-size constants.
+// 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).
#ifdef _MSC_VER
-#define UINT64_C(x) (x ## UI64)
-#define INT64_C(x) (x ## I64)
+#define V8_UINT64_C(x) (x ## UI64)
+#define V8_INT64_C(x) (x ## I64)
+#else
+#define V8_UINT64_C(x) (x ## ULL)
+#define V8_INT64_C(x) (x ## LL)
#endif
// Code-point values in Unicode 4.0 are 21 bits wide.
@@ -120,11 +125,11 @@
// Should be a recognizable hex value tagged as a heap object pointer.
#ifdef V8_ARCH_X64
const Address kZapValue =
- reinterpret_cast<Address>(UINT64_C(0xdeadbeedbeadbeed));
+ reinterpret_cast<Address>(V8_UINT64_C(0xdeadbeedbeadbeed));
const Address kHandleZapValue =
- reinterpret_cast<Address>(UINT64_C(0x1baddead0baddead));
+ reinterpret_cast<Address>(V8_UINT64_C(0x1baddead0baddead));
const Address kFromSpaceZapValue =
- reinterpret_cast<Address>(UINT64_C(0x1beefdad0beefdad));
+ reinterpret_cast<Address>(V8_UINT64_C(0x1beefdad0beefdad));
#else
const Address kZapValue = reinterpret_cast<Address>(0xdeadbeed);
const Address kHandleZapValue = reinterpret_cast<Address>(0xbaddead);
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---