Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: webrtc/base/basictypes_unittest.cc

Issue 1186093004: Define uint64 and int64 using long long. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/basictypes.h ('k') | webrtc/base/helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/base/basictypes.h" 11 #include "webrtc/base/basictypes.h"
12 12
13 #include "webrtc/base/gunit.h" 13 #include "webrtc/base/gunit.h"
14 14
15 namespace rtc { 15 namespace rtc {
16 16
17 static_assert(sizeof(int8) == 1, "Unexpected size");
18 static_assert(sizeof(uint8) == 1, "Unexpected size");
19 static_assert(sizeof(int16) == 2, "Unexpected size");
20 static_assert(sizeof(uint16) == 2, "Unexpected size");
21 static_assert(sizeof(int32) == 4, "Unexpected size");
22 static_assert(sizeof(uint32) == 4, "Unexpected size");
23 static_assert(sizeof(int64) == 8, "Unexpected size");
24 static_assert(sizeof(uint64) == 8, "Unexpected size");
25
17 TEST(BasicTypesTest, Endian) { 26 TEST(BasicTypesTest, Endian) {
18 uint16 v16 = 0x1234u; 27 uint16 v16 = 0x1234u;
19 uint8 first_byte = *reinterpret_cast<uint8*>(&v16); 28 uint8 first_byte = *reinterpret_cast<uint8*>(&v16);
20 #if defined(ARCH_CPU_LITTLE_ENDIAN) 29 #if defined(ARCH_CPU_LITTLE_ENDIAN)
21 EXPECT_EQ(0x34u, first_byte); 30 EXPECT_EQ(0x34u, first_byte);
22 #elif defined(ARCH_CPU_BIG_ENDIAN) 31 #elif defined(ARCH_CPU_BIG_ENDIAN)
23 EXPECT_EQ(0x12u, first_byte); 32 EXPECT_EQ(0x12u, first_byte);
24 #endif 33 #endif
25 } 34 }
26 35
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #error expected CPU_X86 to be defined. 75 #error expected CPU_X86 to be defined.
67 #endif 76 #endif
68 #if !defined(ARCH_CPU_LITTLE_ENDIAN) && \ 77 #if !defined(ARCH_CPU_LITTLE_ENDIAN) && \
69 (defined(WEBRTC_WIN) || defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) || defined (CPU_X86)) 78 (defined(WEBRTC_WIN) || defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) || defined (CPU_X86))
70 #error expected ARCH_CPU_LITTLE_ENDIAN to be defined. 79 #error expected ARCH_CPU_LITTLE_ENDIAN to be defined.
71 #endif 80 #endif
72 81
73 // TODO(fbarchard): Test all macros in basictypes.h 82 // TODO(fbarchard): Test all macros in basictypes.h
74 83
75 } // namespace rtc 84 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/basictypes.h ('k') | webrtc/base/helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698