Commit 3208992c authored by tfarina's avatar tfarina Committed by Commit bot

base: Remove the remaining usage of GG_(U)INTn_C macros.

According to comment in base/port.h, in Chromium, we force-define
__STDC_CONSTANT_MACROS, so we can just use the regular (U)INTn_C macros from
<stdint.h>.

BUG=138542
TEST=base_unittests
R=danakj@chromium.org

Review URL: https://codereview.chromium.org/1128203010

Cr-Commit-Position: refs/heads/master@{#330440}
parent 6edecc8c
......@@ -4,6 +4,7 @@
#include "base/containers/hash_tables.h"
#include <stdint.h>
#include <string>
#include "base/basictypes.h"
......@@ -31,7 +32,7 @@ TEST_F(HashPairTest, IntegerPairs) {
INSERT_PAIR_TEST(Int16Int16Pair, 4, 6);
INSERT_PAIR_TEST(Int16Int32Pair, 9, (1 << 29) + 378128932);
INSERT_PAIR_TEST(Int16Int64Pair, 10,
(GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
(INT64_C(1) << 60) + INT64_C(78931732321));
typedef std::pair<int32, int16> Int32Int16Pair;
typedef std::pair<int32, int32> Int32Int32Pair;
......@@ -40,7 +41,7 @@ TEST_F(HashPairTest, IntegerPairs) {
INSERT_PAIR_TEST(Int32Int16Pair, 4, 6);
INSERT_PAIR_TEST(Int32Int32Pair, 9, (1 << 29) + 378128932);
INSERT_PAIR_TEST(Int32Int64Pair, 10,
(GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
(INT64_C(1) << 60) + INT64_C(78931732321));
typedef std::pair<int64, int16> Int64Int16Pair;
typedef std::pair<int64, int32> Int64Int32Pair;
......@@ -49,7 +50,7 @@ TEST_F(HashPairTest, IntegerPairs) {
INSERT_PAIR_TEST(Int64Int16Pair, 4, 6);
INSERT_PAIR_TEST(Int64Int32Pair, 9, (1 << 29) + 378128932);
INSERT_PAIR_TEST(Int64Int64Pair, 10,
(GG_INT64_C(1) << 60) + GG_INT64_C(78931732321));
(INT64_C(1) << 60) + INT64_C(78931732321));
}
// Verify that base::hash_set<const char*> compares by pointer value, not as C
......
......@@ -5,6 +5,7 @@
#include "base/rand_util.h"
#include <math.h>
#include <stdint.h>
#include <algorithm>
#include <limits>
......@@ -37,7 +38,7 @@ double BitsToOpenEndedUnitInterval(uint64 bits) {
COMPILE_ASSERT(std::numeric_limits<double>::radix == 2, otherwise_use_scalbn);
static const int kBits = std::numeric_limits<double>::digits;
uint64 random_bits = bits & ((GG_UINT64_C(1) << kBits) - 1);
uint64 random_bits = bits & ((UINT64_C(1) << kBits) - 1);
double result = ldexp(static_cast<double>(random_bits), -1 * kBits);
DCHECK_GE(result, 0.0);
DCHECK_LT(result, 1.0);
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/strings/string_number_conversions.h"
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
......@@ -10,7 +12,6 @@
#include <limits>
#include "base/format_macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -237,10 +238,10 @@ TEST(StringNumberConversionsTest, StringToInt64) {
{"42", 42, true},
{"-2147483648", INT_MIN, true},
{"2147483647", INT_MAX, true},
{"-2147483649", GG_INT64_C(-2147483649), true},
{"-99999999999", GG_INT64_C(-99999999999), true},
{"2147483648", GG_INT64_C(2147483648), true},
{"99999999999", GG_INT64_C(99999999999), true},
{"-2147483649", INT64_C(-2147483649), true},
{"-99999999999", INT64_C(-99999999999), true},
{"2147483648", INT64_C(2147483648), true},
{"99999999999", INT64_C(99999999999), true},
{"9223372036854775807", kint64max, true},
{"-9223372036854775808", kint64min, true},
{"09", 9, true},
......@@ -304,8 +305,8 @@ TEST(StringNumberConversionsTest, StringToUint64) {
{"2147483647", INT_MAX, true},
{"-2147483649", 0, false},
{"-99999999999", 0, false},
{"2147483648", GG_UINT64_C(2147483648), true},
{"99999999999", GG_UINT64_C(99999999999), true},
{"2147483648", UINT64_C(2147483648), true},
{"99999999999", UINT64_C(99999999999), true},
{"9223372036854775807", kint64max, true},
{"-9223372036854775808", 0, false},
{"09", 9, true},
......@@ -327,7 +328,7 @@ TEST(StringNumberConversionsTest, StringToUint64) {
{"-", 0, false},
{"-9223372036854775809", 0, false},
{"-99999999999999999999", 0, false},
{"9223372036854775808", GG_UINT64_C(9223372036854775808), true},
{"9223372036854775808", UINT64_C(9223372036854775808), true},
{"99999999999999999999", kuint64max, false},
{"18446744073709551615", kuint64max, true},
{"18446744073709551616", kuint64max, false},
......@@ -550,7 +551,7 @@ TEST(StringNumberConversionsTest, HexStringToInt64) {
{"42", 66, true},
{"-42", -66, true},
{"+42", 66, true},
{"40acd88557b", GG_INT64_C(4444444448123), true},
{"40acd88557b", INT64_C(4444444448123), true},
{"7fffffff", INT_MAX, true},
{"-80000000", INT_MIN, true},
{"ffffffff", 0xffffffff, true},
......@@ -558,7 +559,7 @@ TEST(StringNumberConversionsTest, HexStringToInt64) {
{"0x42", 66, true},
{"-0x42", -66, true},
{"+0x42", 66, true},
{"0x40acd88557b", GG_INT64_C(4444444448123), true},
{"0x40acd88557b", INT64_C(4444444448123), true},
{"0x7fffffff", INT_MAX, true},
{"-0x80000000", INT_MIN, true},
{"0xffffffff", 0xffffffff, true},
......@@ -607,7 +608,7 @@ TEST(StringNumberConversionsTest, HexStringToUInt64) {
{"42", 66, true},
{"-42", 0, false},
{"+42", 66, true},
{"40acd88557b", GG_INT64_C(4444444448123), true},
{"40acd88557b", INT64_C(4444444448123), true},
{"7fffffff", INT_MAX, true},
{"-80000000", 0, false},
{"ffffffff", 0xffffffff, true},
......@@ -615,14 +616,14 @@ TEST(StringNumberConversionsTest, HexStringToUInt64) {
{"0x42", 66, true},
{"-0x42", 0, false},
{"+0x42", 66, true},
{"0x40acd88557b", GG_INT64_C(4444444448123), true},
{"0x40acd88557b", INT64_C(4444444448123), true},
{"0x7fffffff", INT_MAX, true},
{"-0x80000000", 0, false},
{"0xffffffff", 0xffffffff, true},
{"0XDeadBeef", 0xdeadbeef, true},
{"0x7fffffffffffffff", kint64max, true},
{"-0x8000000000000000", 0, false},
{"0x8000000000000000", GG_UINT64_C(0x8000000000000000), true},
{"0x8000000000000000", UINT64_C(0x8000000000000000), true},
{"-0x8000000000000001", 0, false},
{"0xFFFFFFFFFFFFFFFF", kuint64max, true},
{"FFFFFFFFFFFFFFFF", kuint64max, true},
......
......@@ -8,6 +8,7 @@
#include <CoreFoundation/CFTimeZone.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <stdint.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/types.h>
......@@ -114,7 +115,7 @@ namespace base {
// => Thu Jan 01 00:00:00 UTC 1970
// irb(main):011:0> Time.at(-11644473600).getutc()
// => Mon Jan 01 00:00:00 UTC 1601
static const int64 kWindowsEpochDeltaSeconds = GG_INT64_C(11644473600);
static const int64 kWindowsEpochDeltaSeconds = INT64_C(11644473600);
// static
const int64 Time::kWindowsEpochDeltaMicroseconds =
......
......@@ -137,7 +137,7 @@ struct timespec TimeDelta::ToTimeSpec() const {
// => Thu Jan 01 00:00:00 UTC 1970
// irb(main):011:0> Time.at(-11644473600).getutc()
// => Mon Jan 01 00:00:00 UTC 1601
static const int64 kWindowsEpochDeltaSeconds = GG_INT64_C(11644473600);
static const int64 kWindowsEpochDeltaSeconds = INT64_C(11644473600);
// static
const int64 Time::kWindowsEpochDeltaMicroseconds =
......
......@@ -4,8 +4,8 @@
#include "base/time/time.h"
#include <stdint.h>
#include <time.h>
#include <limits>
#include <string>
......@@ -832,7 +832,7 @@ TEST(TimeDelta, WindowsEpoch) {
exploded.millisecond = 0;
Time t = Time::FromUTCExploded(exploded);
// Unix 1970 epoch.
EXPECT_EQ(GG_INT64_C(11644473600000000), t.ToInternalValue());
EXPECT_EQ(INT64_C(11644473600000000), t.ToInternalValue());
// We can't test 1601 epoch, since the system time functions on Linux
// only compute years starting from 1900.
......
......@@ -36,6 +36,7 @@
#pragma comment(lib, "winmm.lib")
#include <windows.h>
#include <mmsystem.h>
#include <stdint.h>
#include "base/basictypes.h"
#include "base/cpu.h"
......@@ -106,7 +107,7 @@ base::LazyInstance<base::Lock>::Leaky g_high_res_lock =
// number of leap year days between 1601 and 1970: (1970-1601)/4 excluding
// 1700, 1800, and 1900.
// static
const int64 Time::kTimeTToMicrosecondsOffset = GG_INT64_C(11644473600000000);
const int64 Time::kTimeTToMicrosecondsOffset = INT64_C(11644473600000000);
// static
Time Time::Now() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment