diff options
author | Milo Yip <miloyip@gmail.com> | 2014-08-08 17:34:43 +0400 |
---|---|---|
committer | Milo Yip <miloyip@gmail.com> | 2014-08-08 17:34:43 +0400 |
commit | 5e5fb7b3d8d297fff731d1f7c0b4cbb6932a833f (patch) | |
tree | 7e96c75b8a499be272d23a6c25b33c9365b63a57 /include/rapidjson/rapidjson.h | |
parent | 41dde39bbc41c74b81540ad84c31df8fc25b982f (diff) |
Change UINT64_C() to RAPIDJSON_UINT64_C2()
Fix #94
Diffstat (limited to 'include/rapidjson/rapidjson.h')
-rw-r--r-- | include/rapidjson/rapidjson.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/include/rapidjson/rapidjson.h b/include/rapidjson/rapidjson.h index 562b4947..d25f02b4 100644 --- a/include/rapidjson/rapidjson.h +++ b/include/rapidjson/rapidjson.h @@ -16,14 +16,10 @@ ///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_NO_INT64DEFINE
-// Here defines int64_t and uint64_t types in global namespace as well as the
-// (U)INT64_C constant macros.
+// Here defines int64_t and uint64_t types in global namespace
// If user have their own definition, can define RAPIDJSON_NO_INT64DEFINE to disable this.
#ifndef RAPIDJSON_NO_INT64DEFINE
//!@cond RAPIDJSON_HIDDEN_FROM_DOXYGEN
-#ifndef __STDC_CONSTANT_MACROS
-# define __STDC_CONSTANT_MACROS 1 // required by C++ standard
-#endif
#ifdef _MSC_VER
#include "msinttypes/stdint.h"
#include "msinttypes/inttypes.h"
@@ -110,6 +106,19 @@ #endif
///////////////////////////////////////////////////////////////////////////////
+// RAPIDJSON_UINT64_C2
+
+//! Construct a 64-bit literal by a pair of 32-bit integer.
+/*!
+ 64-bit literal with or without ULL suffix is prone to compiler warnings.
+ UINT64_C() is C macro which cause compilation problems.
+ Use this macro to define 64-bit constants by a pair of 32-bit integer.
+*/
+#ifndef RAPIDJSON_UINT64_C2
+#define RAPIDJSON_UINT64_C2(high32, low32) ((static_cast<uint64_t>(high32) << 32) | static_cast<uint64_t>(low32))
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
// RAPIDJSON_SSE2/RAPIDJSON_SSE42/RAPIDJSON_SIMD
// Enable SSE2 optimization.
|