summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-07 18:35:10 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-07 18:35:10 +0000
commit8120ab190f48accf55af503b9eda73b52fc4a8e7 (patch)
tree259a3dade283a42700bad50712e5619553a5353b
parentd3f3189f1cd8607b376827e21355d86715ab1aac (diff)
downloadchromium_src-8120ab190f48accf55af503b9eda73b52fc4a8e7.zip
chromium_src-8120ab190f48accf55af503b9eda73b52fc4a8e7.tar.gz
chromium_src-8120ab190f48accf55af503b9eda73b52fc4a8e7.tar.bz2
Revert 262147 "Remove all uses of GG_LONGLONG and GG_ULONGLONG."
> 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 TBR=viettrungluu@chromium.org Review URL: https://codereview.chromium.org/227743006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262165 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/allocator/allocator_unittest.cc10
-rw-r--r--base/atomicops_unittest.cc10
-rw-r--r--base/basictypes.h6
-rw-r--r--base/port.h4
-rw-r--r--chrome/browser/chromeos/drive/file_system_unittest.cc4
-rw-r--r--chrome/browser/devtools/adb/android_rsa.cc4
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_store_file.cc2
-rw-r--r--content/browser/speech/google_streaming_remote_engine.cc4
-rw-r--r--google_apis/drive/gdata_wapi_parser_unittest.cc4
-rw-r--r--media/filters/chunk_demuxer_unittest.cc2
-rw-r--r--media/formats/webm/webm_constants.h2
-rw-r--r--net/base/int128.cc4
-rw-r--r--net/base/int128_unittest.cc18
-rw-r--r--sql/meta_table_unittest.cc4
-rw-r--r--ui/events/gestures/velocity_calculator_unittest.cc2
15 files changed, 41 insertions, 39 deletions
diff --git a/base/allocator/allocator_unittest.cc b/base/allocator/allocator_unittest.cc
index eead75c..4265251 100644
--- a/base/allocator/allocator_unittest.cc
+++ b/base/allocator/allocator_unittest.cc
@@ -2,11 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm> // for min()
-
#include "base/atomicops.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -83,6 +81,8 @@ 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 +164,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 = (static_cast<uint64_t>(1) <<
+ const AtomicType k_test_val = (GG_ULONGLONG(1) <<
(NUM_BITS(AtomicType) - 2)) + 11;
value = k_test_val;
prev = base::subtle::NoBarrier_CompareAndSwap(&value, 0, 5);
@@ -187,7 +187,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 = (static_cast<uint64_t>(1) <<
+ const AtomicType k_test_val = (GG_ULONGLONG(1) <<
(NUM_BITS(AtomicType) - 2)) + 11;
value = k_test_val;
new_value = base::subtle::NoBarrier_AtomicExchange(&value, k_test_val);
@@ -205,7 +205,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 = static_cast<uint64_t>(1) << (NUM_BITS(AtomicType) / 2);
+ AtomicType test_val = GG_ULONGLONG(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 3fd5597..d73a098 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 = (static_cast<uint64_t>(1) <<
+ const AtomicType k_test_val = (GG_ULONGLONG(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 = (static_cast<uint64_t>(1) <<
+ const AtomicType k_test_val = (GG_ULONGLONG(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 = (static_cast<uint64_t>(1) <<
+ AtomicType test_val = (GG_ULONGLONG(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 = static_cast<uint64_t>(1) << (NUM_BITS(AtomicType) / 2);
+ test_val = GG_ULONGLONG(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 b0019f2..0ac8c36 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) 0xFFFFFFFFFFFFFFFFULL);
+const uint64 kuint64max = ((uint64) GG_LONGLONG(0xFFFFFFFFFFFFFFFF));
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) 0x8000000000000000LL);
-const int64 kint64max = (( int64) 0x7FFFFFFFFFFFFFFFLL);
+const int64 kint64min = (( int64) GG_LONGLONG(0x8000000000000000));
+const int64 kint64max = (( int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
#endif // BASE_BASICTYPES_H_
diff --git a/base/port.h b/base/port.h
index 0a04d55..307f257 100644
--- a/base/port.h
+++ b/base/port.h
@@ -8,10 +8,6 @@
#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 0d71883..6efbaa3 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(6789012345LL, bytes_used);
- EXPECT_EQ(9876543210LL, bytes_total);
+ EXPECT_EQ(GG_LONGLONG(6789012345), bytes_used);
+ EXPECT_EQ(GG_LONGLONG(9876543210), 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 c88d9b8..27a52b4 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 += 0x100000000LL;
+ sub += GG_LONGLONG(0x100000000);
}
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, 0x100000000LL);
+ pkey.n0inv = 0 - ModInverse(n0, GG_LONGLONG(0x100000000));
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 78183e0..b58d961 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc
@@ -45,7 +45,7 @@ const int64 kUpdateStorageBytes = 100 * 1024;
const uint32 kMinShardStride = 1 << 24;
// Strides over the entire SBPrefix space.
-const uint64 kMaxShardStride = 1ULL << 32;
+const uint64 kMaxShardStride = GG_LONGLONG(1u) << 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 6b78f23..88a461a 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 = 0x00000000FFFFFFFFLL;
- const int64 kKeepHighBytes = 0xFFFFFFFF00000000LL;
+ const int64 kKeepLowBytes = GG_LONGLONG(0x00000000FFFFFFFF);
+ const int64 kKeepHighBytes = GG_LONGLONG(0xFFFFFFFF00000000);
// 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 e37829e..d4d9a84 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(6789012345LL, metadata->quota_bytes_used());
- EXPECT_EQ(9876543210LL, metadata->quota_bytes_total());
+ EXPECT_EQ(GG_LONGLONG(6789012345), metadata->quota_bytes_used());
+ EXPECT_EQ(GG_LONGLONG(9876543210), 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 9df5108..52516c7 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 < 0x00FFFFFFFFFFFFFFLL);
+ DCHECK(number >= 0 && number < GG_LONGLONG(0x00FFFFFFFFFFFFFF));
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 8a0b8a7..6803bf7 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 = 0x00FFFFFFFFFFFFFFLL;
+const int64 kWebMUnknownSize = GG_LONGLONG(0x00FFFFFFFFFFFFFF);
const uint8 kWebMFlagKeyframe = 0x80;
diff --git a/net/base/int128.cc b/net/base/int128.cc
index 94275eb..745d8ed 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>(0xFFFFFFFFFFFFFFFFULL),
- static_cast<uint64>(0xFFFFFFFFFFFFFFFFULL)
+ static_cast<uint64>(GG_LONGLONG(0xFFFFFFFFFFFFFFFF)),
+ static_cast<uint64>(GG_LONGLONG(0xFFFFFFFFFFFFFFFF))
};
std::ostream& operator<<(std::ostream& o, const uint128& b) {
diff --git a/net/base/int128_unittest.cc b/net/base/int128_unittest.cc
index 957038b..78790e7 100644
--- a/net/base/int128_unittest.cc
+++ b/net/base/int128_unittest.cc
@@ -230,18 +230,24 @@ TEST(Int128, Multiply) {
}
// Verified with dc.
- a = uint128(0xffffeeeeddddccccULL, 0xbbbbaaaa99998888ULL);
- b = uint128(0x7777666655554444ULL, 0x3333222211110000ULL);
+ a = uint128(GG_ULONGLONG(0xffffeeeeddddcccc),
+ GG_ULONGLONG(0xbbbbaaaa99998888));
+ b = uint128(GG_ULONGLONG(0x7777666655554444),
+ GG_ULONGLONG(0x3333222211110000));
c = a * b;
- EXPECT_EQ(uint128(0x530EDA741C71D4C3ULL, 0xBF25975319080000ULL), c);
+ EXPECT_EQ(uint128(GG_ULONGLONG(0x530EDA741C71D4C3),
+ GG_ULONGLONG(0xBF25975319080000)), c);
EXPECT_EQ(0, c - b * a);
EXPECT_EQ(a*a - b*b, (a+b) * (a-b));
// Verified with dc.
- a = uint128(0x0123456789abcdefULL, 0xfedcba9876543210ULL);
- b = uint128(0x02468ace13579bdfULL, 0xfdb97531eca86420ULL);
+ a = uint128(GG_ULONGLONG(0x0123456789abcdef),
+ GG_ULONGLONG(0xfedcba9876543210));
+ b = uint128(GG_ULONGLONG(0x02468ace13579bdf),
+ GG_ULONGLONG(0xfdb97531eca86420));
c = a * b;
- EXPECT_EQ(uint128(0x97a87f4f261ba3f2ULL, 0x342d0bbf48948200ULL), c);
+ EXPECT_EQ(uint128(GG_ULONGLONG(0x97a87f4f261ba3f2),
+ GG_ULONGLONG(0x342d0bbf48948200)), 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 23b020f..2ffb4bd 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 = 5000000017LL;
- const int64 kSecondValue = 5000000023LL;
+ const int64 kFirstValue = GG_LONGLONG(5000000017);
+ const int64 kSecondValue = GG_LONGLONG(5000000023);
// 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 4e89217..3352acd 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 = 1223372036800000000LL;
+ start_time = GG_LONGLONG(1223372036800000000);
velocity_calculator.PointSeen(9, -11, start_time);
velocity_calculator.PointSeen(21, -19, start_time + 8);
velocity_calculator.PointSeen(30, -32, start_time + 16);