Remove all uses of GG_LONGLONG and GG_ULONGLONG.
123LL and 123ULL now work everywhere. You can also use INT64_C and
UINT64_C (from <stdint.h>) in Chromium code (we force-define
__STDC_CONSTANT_MACROS). (And sometimes you can just use
static_cast<(u)int64_t>.)
Don't remove their definitions yet, because some macros that are
multiply-defined (in an identical way) rely on them. D'oh.
R=brettw@chromium.org
TBR=sky@chromium.org,satorux@chromium.org,vrk@chromium.org,rch@chromium.org,shess@chromium.org
Review URL: https://codereview.chromium.org/218953003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262147 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 9406c05f78eccb7cc2849cf87a4202e1538ecb9c
diff --git a/base/atomicops_unittest.cc b/base/atomicops_unittest.cc
index d73a098..3fd5597 100644
--- a/base/atomicops_unittest.cc
+++ b/base/atomicops_unittest.cc
@@ -4,9 +4,9 @@
#include "base/atomicops.h"
+#include <stdint.h>
#include <string.h>
-#include "base/port.h"
#include "testing/gtest/include/gtest/gtest.h"
template <class AtomicType>
@@ -91,7 +91,7 @@
// Use test value that has non-zero bits in both halves, more for testing
// 64-bit implementation on 32-bit platforms.
- const AtomicType k_test_val = (GG_ULONGLONG(1) <<
+ const AtomicType k_test_val = (static_cast<uint64_t>(1) <<
(NUM_BITS(AtomicType) - 2)) + 11;
value = k_test_val;
prev = base::subtle::NoBarrier_CompareAndSwap(&value, 0, 5);
@@ -114,7 +114,7 @@
// Use test value that has non-zero bits in both halves, more for testing
// 64-bit implementation on 32-bit platforms.
- const AtomicType k_test_val = (GG_ULONGLONG(1) <<
+ const AtomicType k_test_val = (static_cast<uint64_t>(1) <<
(NUM_BITS(AtomicType) - 2)) + 11;
value = k_test_val;
new_value = base::subtle::NoBarrier_AtomicExchange(&value, k_test_val);
@@ -131,7 +131,7 @@
template <class AtomicType>
static void TestAtomicIncrementBounds() {
// Test at rollover boundary between int_max and int_min
- AtomicType test_val = (GG_ULONGLONG(1) <<
+ AtomicType test_val = (static_cast<uint64_t>(1) <<
(NUM_BITS(AtomicType) - 1));
AtomicType value = -1 ^ test_val;
AtomicType new_value = base::subtle::NoBarrier_AtomicIncrement(&value, 1);
@@ -142,7 +142,7 @@
EXPECT_EQ(-1 ^ test_val, value);
// Test at 32-bit boundary for 64-bit atomic type.
- test_val = GG_ULONGLONG(1) << (NUM_BITS(AtomicType) / 2);
+ test_val = static_cast<uint64_t>(1) << (NUM_BITS(AtomicType) / 2);
value = test_val - 1;
new_value = base::subtle::NoBarrier_AtomicIncrement(&value, 1);
EXPECT_EQ(test_val, value);
diff --git a/base/basictypes.h b/base/basictypes.h
index 0ac8c36..b0019f2 100644
--- a/base/basictypes.h
+++ b/base/basictypes.h
@@ -45,14 +45,14 @@
const uint8 kuint8max = (( uint8) 0xFF);
const uint16 kuint16max = ((uint16) 0xFFFF);
const uint32 kuint32max = ((uint32) 0xFFFFFFFF);
-const uint64 kuint64max = ((uint64) GG_LONGLONG(0xFFFFFFFFFFFFFFFF));
+const uint64 kuint64max = ((uint64) 0xFFFFFFFFFFFFFFFFULL);
const int8 kint8min = (( int8) 0x80);
const int8 kint8max = (( int8) 0x7F);
const int16 kint16min = (( int16) 0x8000);
const int16 kint16max = (( int16) 0x7FFF);
const int32 kint32min = (( int32) 0x80000000);
const int32 kint32max = (( int32) 0x7FFFFFFF);
-const int64 kint64min = (( int64) GG_LONGLONG(0x8000000000000000));
-const int64 kint64max = (( int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
+const int64 kint64min = (( int64) 0x8000000000000000LL);
+const int64 kint64max = (( int64) 0x7FFFFFFFFFFFFFFFLL);
#endif // BASE_BASICTYPES_H_
diff --git a/base/port.h b/base/port.h
index 307f257..0a04d55 100644
--- a/base/port.h
+++ b/base/port.h
@@ -8,6 +8,10 @@
#include <stdarg.h>
#include "build/build_config.h"
+// DEPRECATED: Use ...LL and ...ULL suffixes.
+// TODO(viettrungluu): Delete these. These are only here until |GG_(U)INT64_C|
+// are deleted (some other header files (re)define |GG_(U)INT64_C|, so our
+// definitions of them must exactly match theirs).
#ifdef COMPILER_MSVC
#define GG_LONGLONG(x) x##I64
#define GG_ULONGLONG(x) x##UI64