diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-08 04:00:36 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-08 04:00:36 +0000 |
commit | da463967e200fe91ccc3384db8f8ba34c08f3847 (patch) | |
tree | ba720771cabfc0d3a2463de69b15faf65c061e31 | |
parent | 53bfa860a4ede0a1f85f02b8d9d8a3896b6b0eb2 (diff) | |
download | chromium_src-da463967e200fe91ccc3384db8f8ba34c08f3847.zip chromium_src-da463967e200fe91ccc3384db8f8ba34c08f3847.tar.gz chromium_src-da463967e200fe91ccc3384db8f8ba34c08f3847.tar.bz2 |
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
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=262147
Review URL: https://codereview.chromium.org/218953003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262294 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/allocator/allocator_unittest.cc | 9 | ||||
-rw-r--r-- | base/atomicops_unittest.cc | 10 | ||||
-rw-r--r-- | base/basictypes.h | 6 | ||||
-rw-r--r-- | base/port.h | 4 | ||||
-rw-r--r-- | chrome/browser/chromeos/drive/file_system_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/devtools/adb/android_rsa.cc | 4 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_store_file.cc | 2 | ||||
-rw-r--r-- | content/browser/speech/google_streaming_remote_engine.cc | 4 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_parser_unittest.cc | 4 | ||||
-rw-r--r-- | media/filters/chunk_demuxer_unittest.cc | 2 | ||||
-rw-r--r-- | media/formats/webm/webm_constants.h | 2 | ||||
-rw-r--r-- | net/base/int128.cc | 4 | ||||
-rw-r--r-- | net/base/int128_unittest.cc | 18 | ||||
-rw-r--r-- | sql/meta_table_unittest.cc | 4 | ||||
-rw-r--r-- | ui/events/gestures/velocity_calculator_unittest.cc | 2 |
15 files changed, 38 insertions, 41 deletions
diff --git a/base/allocator/allocator_unittest.cc b/base/allocator/allocator_unittest.cc index 4265251..eb20b38 100644 --- a/base/allocator/allocator_unittest.cc +++ b/base/allocator/allocator_unittest.cc @@ -5,6 +5,7 @@ #include <stdio.h> #include <stdlib.h> #include <algorithm> // for min() + #include "base/atomicops.h" #include "testing/gtest/include/gtest/gtest.h" @@ -81,8 +82,6 @@ static int NextSize(int size) { } } -#define GG_ULONGLONG(x) static_cast<uint64>(x) - template <class AtomicType> static void TestAtomicIncrement() { // For now, we just test single threaded execution @@ -164,7 +163,7 @@ static void TestCompareAndSwap() { // 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); @@ -187,7 +186,7 @@ static void TestAtomicExchange() { // 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); @@ -205,7 +204,7 @@ template <class AtomicType> static void TestAtomicIncrementBounds() { // Test increment at the half-width boundary of the atomic type. // It is primarily for testing at the 32-bit boundary for 64-bit atomic type. - AtomicType test_val = GG_ULONGLONG(1) << (NUM_BITS(AtomicType) / 2); + AtomicType test_val = static_cast<uint64_t>(1) << (NUM_BITS(AtomicType) / 2); AtomicType value = test_val - 1; AtomicType new_value = base::subtle::NoBarrier_AtomicIncrement(&value, 1); EXPECT_EQ(test_val, value); 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 @@ static void TestCompareAndSwap() { // 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 @@ static void TestAtomicExchange() { // 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 @@ static void TestAtomicExchange() { 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 @@ static void TestAtomicIncrementBounds() { 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 @@ typedef unsigned long long uint64; 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 diff --git a/chrome/browser/chromeos/drive/file_system_unittest.cc b/chrome/browser/chromeos/drive/file_system_unittest.cc index 6efbaa3..0d71883 100644 --- a/chrome/browser/chromeos/drive/file_system_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system_unittest.cc @@ -858,8 +858,8 @@ TEST_F(FileSystemTest, GetAvailableSpace) { google_apis::test_util::CreateCopyResultCallback( &error, &bytes_total, &bytes_used)); test_util::RunBlockingPoolTask(); - EXPECT_EQ(GG_LONGLONG(6789012345), bytes_used); - EXPECT_EQ(GG_LONGLONG(9876543210), bytes_total); + EXPECT_EQ(6789012345LL, bytes_used); + EXPECT_EQ(9876543210LL, bytes_total); } TEST_F(FileSystemTest, MarkCacheFileAsMountedAndUnmounted) { diff --git a/chrome/browser/devtools/adb/android_rsa.cc b/chrome/browser/devtools/adb/android_rsa.cc index 27a52b4..c88d9b8 100644 --- a/chrome/browser/devtools/adb/android_rsa.cc +++ b/chrome/browser/devtools/adb/android_rsa.cc @@ -100,7 +100,7 @@ void BnSub(uint32* a, uint32* b) { carry_over = 0; if (sub < 0) { carry_over = 1; - sub += GG_LONGLONG(0x100000000); + sub += 0x100000000LL; } a[i] = static_cast<uint32>(sub); } @@ -233,7 +233,7 @@ std::string AndroidRSAPublicKey(crypto::RSAPrivateKey* key) { RSAPublicKey pkey; pkey.len = kRSANumWords; pkey.exponent = 65537; // Fixed public exponent - pkey.n0inv = 0 - ModInverse(n0, GG_LONGLONG(0x100000000)); + pkey.n0inv = 0 - ModInverse(n0, 0x100000000LL); if (pkey.n0inv == 0) return kDummyRSAPublicKey; diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc index 42e081d..50c1b5f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc @@ -46,7 +46,7 @@ const int64 kUpdateStorageBytes = 100 * 1024; const uint32 kMinShardStride = 1 << 24; // Strides over the entire SBPrefix space. -const uint64 kMaxShardStride = GG_LONGLONG(1u) << 32; +const uint64 kMaxShardStride = 1ULL << 32; // Maximum SBPrefix value. const SBPrefix kMaxSBPrefix = ~0; diff --git a/content/browser/speech/google_streaming_remote_engine.cc b/content/browser/speech/google_streaming_remote_engine.cc index 88a461a..6b78f23 100644 --- a/content/browser/speech/google_streaming_remote_engine.cc +++ b/content/browser/speech/google_streaming_remote_engine.cc @@ -563,8 +563,8 @@ std::string GoogleStreamingRemoteEngine::GetAcceptedLanguages() const { // TODO(primiano): Is there any utility in the codebase that already does this? std::string GoogleStreamingRemoteEngine::GenerateRequestKey() const { - const int64 kKeepLowBytes = GG_LONGLONG(0x00000000FFFFFFFF); - const int64 kKeepHighBytes = GG_LONGLONG(0xFFFFFFFF00000000); + const int64 kKeepLowBytes = 0x00000000FFFFFFFFLL; + const int64 kKeepHighBytes = 0xFFFFFFFF00000000LL; // Just keep the least significant bits of timestamp, in order to reduce // probability of collisions. diff --git a/google_apis/drive/gdata_wapi_parser_unittest.cc b/google_apis/drive/gdata_wapi_parser_unittest.cc index d4d9a84..e37829e 100644 --- a/google_apis/drive/gdata_wapi_parser_unittest.cc +++ b/google_apis/drive/gdata_wapi_parser_unittest.cc @@ -248,8 +248,8 @@ TEST(GDataWAPIParserTest, AccountMetadataParser) { scoped_ptr<AccountMetadata> metadata( AccountMetadata::CreateFrom(*document)); ASSERT_TRUE(metadata.get()); - EXPECT_EQ(GG_LONGLONG(6789012345), metadata->quota_bytes_used()); - EXPECT_EQ(GG_LONGLONG(9876543210), metadata->quota_bytes_total()); + EXPECT_EQ(6789012345LL, metadata->quota_bytes_used()); + EXPECT_EQ(9876543210LL, metadata->quota_bytes_total()); EXPECT_EQ(654321, metadata->largest_changestamp()); EXPECT_EQ(2U, metadata->installed_apps().size()); const InstalledApp* first_app = metadata->installed_apps()[0]; diff --git a/media/filters/chunk_demuxer_unittest.cc b/media/filters/chunk_demuxer_unittest.cc index 52516c7..9df5108 100644 --- a/media/filters/chunk_demuxer_unittest.cc +++ b/media/filters/chunk_demuxer_unittest.cc @@ -85,7 +85,7 @@ base::TimeDelta kDefaultDuration() { // The data pointed by |buffer| should be at least 8 bytes long. // |number| should be in the range 0 <= number < 0x00FFFFFFFFFFFFFF. static void WriteInt64(uint8* buffer, int64 number) { - DCHECK(number >= 0 && number < GG_LONGLONG(0x00FFFFFFFFFFFFFF)); + DCHECK(number >= 0 && number < 0x00FFFFFFFFFFFFFFLL); buffer[0] = 0x01; int64 tmp = number; for (int i = 7; i > 0; i--) { diff --git a/media/formats/webm/webm_constants.h b/media/formats/webm/webm_constants.h index 6803bf7..8a0b8a7 100644 --- a/media/formats/webm/webm_constants.h +++ b/media/formats/webm/webm_constants.h @@ -201,7 +201,7 @@ const int kWebMIdVoid = 0xEC; const int kWebMIdWritingApp = 0x5741; const int64 kWebMReservedId = 0x1FFFFFFF; -const int64 kWebMUnknownSize = GG_LONGLONG(0x00FFFFFFFFFFFFFF); +const int64 kWebMUnknownSize = 0x00FFFFFFFFFFFFFFLL; const uint8 kWebMFlagKeyframe = 0x80; diff --git a/net/base/int128.cc b/net/base/int128.cc index 745d8ed..94275eb 100644 --- a/net/base/int128.cc +++ b/net/base/int128.cc @@ -7,8 +7,8 @@ #include "net/base/int128.h" const uint128_pod kuint128max = { - static_cast<uint64>(GG_LONGLONG(0xFFFFFFFFFFFFFFFF)), - static_cast<uint64>(GG_LONGLONG(0xFFFFFFFFFFFFFFFF)) + static_cast<uint64>(0xFFFFFFFFFFFFFFFFULL), + static_cast<uint64>(0xFFFFFFFFFFFFFFFFULL) }; std::ostream& operator<<(std::ostream& o, const uint128& b) { diff --git a/net/base/int128_unittest.cc b/net/base/int128_unittest.cc index 78790e7..957038b 100644 --- a/net/base/int128_unittest.cc +++ b/net/base/int128_unittest.cc @@ -230,24 +230,18 @@ TEST(Int128, Multiply) { } // Verified with dc. - a = uint128(GG_ULONGLONG(0xffffeeeeddddcccc), - GG_ULONGLONG(0xbbbbaaaa99998888)); - b = uint128(GG_ULONGLONG(0x7777666655554444), - GG_ULONGLONG(0x3333222211110000)); + a = uint128(0xffffeeeeddddccccULL, 0xbbbbaaaa99998888ULL); + b = uint128(0x7777666655554444ULL, 0x3333222211110000ULL); c = a * b; - EXPECT_EQ(uint128(GG_ULONGLONG(0x530EDA741C71D4C3), - GG_ULONGLONG(0xBF25975319080000)), c); + EXPECT_EQ(uint128(0x530EDA741C71D4C3ULL, 0xBF25975319080000ULL), c); EXPECT_EQ(0, c - b * a); EXPECT_EQ(a*a - b*b, (a+b) * (a-b)); // Verified with dc. - a = uint128(GG_ULONGLONG(0x0123456789abcdef), - GG_ULONGLONG(0xfedcba9876543210)); - b = uint128(GG_ULONGLONG(0x02468ace13579bdf), - GG_ULONGLONG(0xfdb97531eca86420)); + a = uint128(0x0123456789abcdefULL, 0xfedcba9876543210ULL); + b = uint128(0x02468ace13579bdfULL, 0xfdb97531eca86420ULL); c = a * b; - EXPECT_EQ(uint128(GG_ULONGLONG(0x97a87f4f261ba3f2), - GG_ULONGLONG(0x342d0bbf48948200)), c); + EXPECT_EQ(uint128(0x97a87f4f261ba3f2ULL, 0x342d0bbf48948200ULL), c); EXPECT_EQ(0, c - b * a); EXPECT_EQ(a*a - b*b, (a+b) * (a-b)); } diff --git a/sql/meta_table_unittest.cc b/sql/meta_table_unittest.cc index 2ffb4bd..23b020f 100644 --- a/sql/meta_table_unittest.cc +++ b/sql/meta_table_unittest.cc @@ -210,8 +210,8 @@ TEST_F(SQLMetaTableTest, IntValue) { TEST_F(SQLMetaTableTest, Int64Value) { const char kKey[] = "Int Key"; - const int64 kFirstValue = GG_LONGLONG(5000000017); - const int64 kSecondValue = GG_LONGLONG(5000000023); + const int64 kFirstValue = 5000000017LL; + const int64 kSecondValue = 5000000023LL; // Initially, the value isn't there until set. { diff --git a/ui/events/gestures/velocity_calculator_unittest.cc b/ui/events/gestures/velocity_calculator_unittest.cc index 3352acd..4e89217 100644 --- a/ui/events/gestures/velocity_calculator_unittest.cc +++ b/ui/events/gestures/velocity_calculator_unittest.cc @@ -74,7 +74,7 @@ TEST(VelocityCalculatorTest, IsAccurateWithLargeTimes) { EXPECT_GT(velocity_calculator.YVelocity(), -1270000); EXPECT_LT(velocity_calculator.YVelocity(), -1240000); - start_time = GG_LONGLONG(1223372036800000000); + start_time = 1223372036800000000LL; velocity_calculator.PointSeen(9, -11, start_time); velocity_calculator.PointSeen(21, -19, start_time + 8); velocity_calculator.PointSeen(30, -32, start_time + 16); |