diff options
author | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-29 10:16:14 +0000 |
---|---|---|
committer | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-29 10:16:14 +0000 |
commit | ff845a4ee79af7b00dbe7de4b358cae0119b1585 (patch) | |
tree | d9f757e0efdc666d979fa2ba13f02d99dce8a39a /base/atomicops_unittest.cc | |
parent | f9dec56132dffbf5d3aacf4a6af4491dcd87856d (diff) | |
download | chromium_src-ff845a4ee79af7b00dbe7de4b358cae0119b1585.zip chromium_src-ff845a4ee79af7b00dbe7de4b358cae0119b1585.tar.gz chromium_src-ff845a4ee79af7b00dbe7de4b358cae0119b1585.tar.bz2 |
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
Diffstat (limited to 'base/atomicops_unittest.cc')
-rw-r--r-- | base/atomicops_unittest.cc | 12 |
1 files changed, 10 insertions, 2 deletions
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; |