| Index: trunk/src/base/allocator/allocator_unittest.cc
|
| ===================================================================
|
| --- trunk/src/base/allocator/allocator_unittest.cc (revision 262163)
|
| +++ trunk/src/base/allocator/allocator_unittest.cc (working copy)
|
| @@ -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 @@
|
| }
|
| }
|
|
|
| +#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 @@
|
|
|
| // 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 @@
|
|
|
| // 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 @@
|
| 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);
|
|
|