OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 Set8(memory, 5, static_cast<uint8>(v >> 16)); | 56 Set8(memory, 5, static_cast<uint8>(v >> 16)); |
57 Set8(memory, 6, static_cast<uint8>(v >> 8)); | 57 Set8(memory, 6, static_cast<uint8>(v >> 8)); |
58 Set8(memory, 7, static_cast<uint8>(v >> 0)); | 58 Set8(memory, 7, static_cast<uint8>(v >> 0)); |
59 } | 59 } |
60 | 60 |
61 inline uint16 GetBE16(const void* memory) { | 61 inline uint16 GetBE16(const void* memory) { |
62 return static_cast<uint16>((Get8(memory, 0) << 8) | | 62 return static_cast<uint16>((Get8(memory, 0) << 8) | |
63 (Get8(memory, 1) << 0)); | 63 (Get8(memory, 1) << 0)); |
64 } | 64 } |
65 | 65 |
| 66 inline uint32 GetBE24(const void* memory) { |
| 67 return (static_cast<uint32>(Get8(memory, 0)) << 16) | |
| 68 (static_cast<uint32>(Get8(memory, 1)) << 8) | |
| 69 (static_cast<uint32>(Get8(memory, 2)) << 0); |
| 70 } |
| 71 |
66 inline uint32 GetBE32(const void* memory) { | 72 inline uint32 GetBE32(const void* memory) { |
67 return (static_cast<uint32>(Get8(memory, 0)) << 24) | | 73 return (static_cast<uint32>(Get8(memory, 0)) << 24) | |
68 (static_cast<uint32>(Get8(memory, 1)) << 16) | | 74 (static_cast<uint32>(Get8(memory, 1)) << 16) | |
69 (static_cast<uint32>(Get8(memory, 2)) << 8) | | 75 (static_cast<uint32>(Get8(memory, 2)) << 8) | |
70 (static_cast<uint32>(Get8(memory, 3)) << 0); | 76 (static_cast<uint32>(Get8(memory, 3)) << 0); |
71 } | 77 } |
72 | 78 |
73 inline uint64 GetBE64(const void* memory) { | 79 inline uint64 GetBE64(const void* memory) { |
74 return (static_cast<uint64>(Get8(memory, 0)) << 56) | | 80 return (static_cast<uint64>(Get8(memory, 0)) << 56) | |
75 (static_cast<uint64>(Get8(memory, 1)) << 48) | | 81 (static_cast<uint64>(Get8(memory, 1)) << 48) | |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return GetBE32(&n); | 165 return GetBE32(&n); |
160 } | 166 } |
161 | 167 |
162 inline uint64 NetworkToHost64(uint64 n) { | 168 inline uint64 NetworkToHost64(uint64 n) { |
163 return GetBE64(&n); | 169 return GetBE64(&n); |
164 } | 170 } |
165 | 171 |
166 } // namespace rtc | 172 } // namespace rtc |
167 | 173 |
168 #endif // WEBRTC_BASE_BYTEORDER_H_ | 174 #endif // WEBRTC_BASE_BYTEORDER_H_ |
OLD | NEW |