diff options
author | bradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 22:26:24 +0000 |
---|---|---|
committer | bradnelson@google.com <bradnelson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 22:26:24 +0000 |
commit | 87fce2b91c8fa1f10ec49e79c719159097a597c5 (patch) | |
tree | d08dce8d43dd30a90a301cdeea1d53449d5cbd7a /o3d/import | |
parent | bc2a2dd4edbc70339be723c5820d1e5b92fe9236 (diff) | |
download | chromium_src-87fce2b91c8fa1f10ec49e79c719159097a597c5.zip chromium_src-87fce2b91c8fa1f10ec49e79c719159097a597c5.tar.gz chromium_src-87fce2b91c8fa1f10ec49e79c719159097a597c5.tar.bz2 |
This fixes some warnings in the Linux release build.
Review URL: http://codereview.chromium.org/194061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/import')
-rw-r--r-- | o3d/import/cross/memory_stream_test.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/o3d/import/cross/memory_stream_test.cc b/o3d/import/cross/memory_stream_test.cc index f72d7f0..3b238fe 100644 --- a/o3d/import/cross/memory_stream_test.cc +++ b/o3d/import/cross/memory_stream_test.cc @@ -239,16 +239,19 @@ TEST_F(MemoryStreamTest, EndianSanityFloat32) { uint8 *p8 = reinterpret_cast<uint8*>(p); MemoryWriteStream write_stream(p8, sizeof(int32) * 2); - float value = 3.14159f; - write_stream.WriteLittleEndianFloat32(value); - write_stream.WriteBigEndianFloat32(value); + union { + int32 ivalue; + float fvalue; + } value; + value.fvalue = 3.14159f; + write_stream.WriteLittleEndianFloat32(value.fvalue); + write_stream.WriteBigEndianFloat32(value.fvalue); // Verify that the bytes are in the correct order - int32 ivalue = *reinterpret_cast<int32*>(&value); // interpret float as int32 - uint8 byte1 = ivalue & 0xff; - uint8 byte2 = (ivalue >> 8) & 0xff; - uint8 byte3 = (ivalue >> 16) & 0xff; - uint8 byte4 = (ivalue >> 24) & 0xff; + uint8 byte1 = value.ivalue & 0xff; + uint8 byte2 = (value.ivalue >> 8) & 0xff; + uint8 byte3 = (value.ivalue >> 16) & 0xff; + uint8 byte4 = (value.ivalue >> 24) & 0xff; // validate little-endian EXPECT_EQ(byte1, p8[0]); |