Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: src/globals.h

Issue 109017: Use our own macros for 64-bit constants. (Closed)
Patch Set: Remove setting of __STDC_CONSTANT_MACROS. Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/globals.h
diff --git a/src/globals.h b/src/globals.h
index 71bb78e3552a0f4cc871a136f1835956fdb3d20e..6436d9d6e4600c4c2e5197cabe5042bbc97038d8 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -50,10 +50,15 @@ typedef unsigned int __my_bool__;
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 @@ const int kBitsPerInt = kIntSize * kBitsPerByte;
// 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);
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698