From ff845a4ee79af7b00dbe7de4b358cae0119b1585 Mon Sep 17 00:00:00 2001
From: "deanm@google.com"
 <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 29 Aug 2008 10:16:14 +0000
Subject: Fix a test to avoid a MSVC warning as error about constant
 truncation.

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1524 0039d316-1c4b-4281-b951-d872f2087c98
---
 base/atomicops_unittest.cc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'base')

diff --git a/base/atomicops_unittest.cc b/base/atomicops_unittest.cc
index a7aa092..5053b0b 100644
--- a/base/atomicops_unittest.cc
+++ b/base/atomicops_unittest.cc
@@ -148,11 +148,19 @@ static void TestAtomicIncrementBounds() {
   EXPECT_EQ(test_val - 1, value);
 }
 
+// Return an AtomicType with the value 0xa5a5a5..
+template <class AtomicType>
+static AtomicType TestFillValue() {
+  AtomicType val = 0;
+  memset(&val, 0xa5, sizeof(AtomicType));
+  return val;
+}
+
 // This is a simple sanity check that values are correct. Not testing
 // atomicity
 template <class AtomicType>
 static void TestStore() {
-  const AtomicType kVal1 = static_cast<AtomicType>(0xa5a5a5a5a5a5a5a5LL);
+  const AtomicType kVal1 = TestFillValue<AtomicType>();
   const AtomicType kVal2 = static_cast<AtomicType>(-1);
 
   AtomicType value;
@@ -177,7 +185,7 @@ static void TestStore() {
 // atomicity
 template <class AtomicType>
 static void TestLoad() {
-  const AtomicType kVal1 = static_cast<AtomicType>(0xa5a5a5a5a5a5a5a5LL);
+  const AtomicType kVal1 = TestFillValue<AtomicType>();
   const AtomicType kVal2 = static_cast<AtomicType>(-1);
 
   AtomicType value;
-- 
cgit v1.1