| Index: webrtc/base/byteorder.h
|
| diff --git a/webrtc/base/byteorder.h b/webrtc/base/byteorder.h
|
| index d907d9e41280dea3ad10aaed78f4ad8f8b730783..d579e6e185eb73de3ede51bddb809723ff2cfe72 100644
|
| --- a/webrtc/base/byteorder.h
|
| +++ b/webrtc/base/byteorder.h
|
| @@ -27,104 +27,102 @@ namespace rtc {
|
| // TODO: Optimized versions, with direct read/writes of
|
| // integers in host-endian format, when the platform supports it.
|
|
|
| -inline void Set8(void* memory, size_t offset, uint8 v) {
|
| - static_cast<uint8*>(memory)[offset] = v;
|
| +inline void Set8(void* memory, size_t offset, uint8_t v) {
|
| + static_cast<uint8_t*>(memory)[offset] = v;
|
| }
|
|
|
| -inline uint8 Get8(const void* memory, size_t offset) {
|
| - return static_cast<const uint8*>(memory)[offset];
|
| +inline uint8_t Get8(const void* memory, size_t offset) {
|
| + return static_cast<const uint8_t*>(memory)[offset];
|
| }
|
|
|
| -inline void SetBE16(void* memory, uint16 v) {
|
| - Set8(memory, 0, static_cast<uint8>(v >> 8));
|
| - Set8(memory, 1, static_cast<uint8>(v >> 0));
|
| +inline void SetBE16(void* memory, uint16_t v) {
|
| + Set8(memory, 0, static_cast<uint8_t>(v >> 8));
|
| + Set8(memory, 1, static_cast<uint8_t>(v >> 0));
|
| }
|
|
|
| -inline void SetBE32(void* memory, uint32 v) {
|
| - Set8(memory, 0, static_cast<uint8>(v >> 24));
|
| - Set8(memory, 1, static_cast<uint8>(v >> 16));
|
| - Set8(memory, 2, static_cast<uint8>(v >> 8));
|
| - Set8(memory, 3, static_cast<uint8>(v >> 0));
|
| +inline void SetBE32(void* memory, uint32_t v) {
|
| + Set8(memory, 0, static_cast<uint8_t>(v >> 24));
|
| + Set8(memory, 1, static_cast<uint8_t>(v >> 16));
|
| + Set8(memory, 2, static_cast<uint8_t>(v >> 8));
|
| + Set8(memory, 3, static_cast<uint8_t>(v >> 0));
|
| }
|
|
|
| -inline void SetBE64(void* memory, uint64 v) {
|
| - Set8(memory, 0, static_cast<uint8>(v >> 56));
|
| - Set8(memory, 1, static_cast<uint8>(v >> 48));
|
| - Set8(memory, 2, static_cast<uint8>(v >> 40));
|
| - Set8(memory, 3, static_cast<uint8>(v >> 32));
|
| - Set8(memory, 4, static_cast<uint8>(v >> 24));
|
| - Set8(memory, 5, static_cast<uint8>(v >> 16));
|
| - Set8(memory, 6, static_cast<uint8>(v >> 8));
|
| - Set8(memory, 7, static_cast<uint8>(v >> 0));
|
| +inline void SetBE64(void* memory, uint64_t v) {
|
| + Set8(memory, 0, static_cast<uint8_t>(v >> 56));
|
| + Set8(memory, 1, static_cast<uint8_t>(v >> 48));
|
| + Set8(memory, 2, static_cast<uint8_t>(v >> 40));
|
| + Set8(memory, 3, static_cast<uint8_t>(v >> 32));
|
| + Set8(memory, 4, static_cast<uint8_t>(v >> 24));
|
| + Set8(memory, 5, static_cast<uint8_t>(v >> 16));
|
| + Set8(memory, 6, static_cast<uint8_t>(v >> 8));
|
| + Set8(memory, 7, static_cast<uint8_t>(v >> 0));
|
| }
|
|
|
| -inline uint16 GetBE16(const void* memory) {
|
| - return static_cast<uint16>((Get8(memory, 0) << 8) |
|
| - (Get8(memory, 1) << 0));
|
| +inline uint16_t GetBE16(const void* memory) {
|
| + return static_cast<uint16_t>((Get8(memory, 0) << 8) | (Get8(memory, 1) << 0));
|
| }
|
|
|
| -inline uint32 GetBE32(const void* memory) {
|
| - return (static_cast<uint32>(Get8(memory, 0)) << 24) |
|
| - (static_cast<uint32>(Get8(memory, 1)) << 16) |
|
| - (static_cast<uint32>(Get8(memory, 2)) << 8) |
|
| - (static_cast<uint32>(Get8(memory, 3)) << 0);
|
| +inline uint32_t GetBE32(const void* memory) {
|
| + return (static_cast<uint32_t>(Get8(memory, 0)) << 24) |
|
| + (static_cast<uint32_t>(Get8(memory, 1)) << 16) |
|
| + (static_cast<uint32_t>(Get8(memory, 2)) << 8) |
|
| + (static_cast<uint32_t>(Get8(memory, 3)) << 0);
|
| }
|
|
|
| -inline uint64 GetBE64(const void* memory) {
|
| - return (static_cast<uint64>(Get8(memory, 0)) << 56) |
|
| - (static_cast<uint64>(Get8(memory, 1)) << 48) |
|
| - (static_cast<uint64>(Get8(memory, 2)) << 40) |
|
| - (static_cast<uint64>(Get8(memory, 3)) << 32) |
|
| - (static_cast<uint64>(Get8(memory, 4)) << 24) |
|
| - (static_cast<uint64>(Get8(memory, 5)) << 16) |
|
| - (static_cast<uint64>(Get8(memory, 6)) << 8) |
|
| - (static_cast<uint64>(Get8(memory, 7)) << 0);
|
| +inline uint64_t GetBE64(const void* memory) {
|
| + return (static_cast<uint64_t>(Get8(memory, 0)) << 56) |
|
| + (static_cast<uint64_t>(Get8(memory, 1)) << 48) |
|
| + (static_cast<uint64_t>(Get8(memory, 2)) << 40) |
|
| + (static_cast<uint64_t>(Get8(memory, 3)) << 32) |
|
| + (static_cast<uint64_t>(Get8(memory, 4)) << 24) |
|
| + (static_cast<uint64_t>(Get8(memory, 5)) << 16) |
|
| + (static_cast<uint64_t>(Get8(memory, 6)) << 8) |
|
| + (static_cast<uint64_t>(Get8(memory, 7)) << 0);
|
| }
|
|
|
| -inline void SetLE16(void* memory, uint16 v) {
|
| - Set8(memory, 0, static_cast<uint8>(v >> 0));
|
| - Set8(memory, 1, static_cast<uint8>(v >> 8));
|
| +inline void SetLE16(void* memory, uint16_t v) {
|
| + Set8(memory, 0, static_cast<uint8_t>(v >> 0));
|
| + Set8(memory, 1, static_cast<uint8_t>(v >> 8));
|
| }
|
|
|
| -inline void SetLE32(void* memory, uint32 v) {
|
| - Set8(memory, 0, static_cast<uint8>(v >> 0));
|
| - Set8(memory, 1, static_cast<uint8>(v >> 8));
|
| - Set8(memory, 2, static_cast<uint8>(v >> 16));
|
| - Set8(memory, 3, static_cast<uint8>(v >> 24));
|
| +inline void SetLE32(void* memory, uint32_t v) {
|
| + Set8(memory, 0, static_cast<uint8_t>(v >> 0));
|
| + Set8(memory, 1, static_cast<uint8_t>(v >> 8));
|
| + Set8(memory, 2, static_cast<uint8_t>(v >> 16));
|
| + Set8(memory, 3, static_cast<uint8_t>(v >> 24));
|
| }
|
|
|
| -inline void SetLE64(void* memory, uint64 v) {
|
| - Set8(memory, 0, static_cast<uint8>(v >> 0));
|
| - Set8(memory, 1, static_cast<uint8>(v >> 8));
|
| - Set8(memory, 2, static_cast<uint8>(v >> 16));
|
| - Set8(memory, 3, static_cast<uint8>(v >> 24));
|
| - Set8(memory, 4, static_cast<uint8>(v >> 32));
|
| - Set8(memory, 5, static_cast<uint8>(v >> 40));
|
| - Set8(memory, 6, static_cast<uint8>(v >> 48));
|
| - Set8(memory, 7, static_cast<uint8>(v >> 56));
|
| +inline void SetLE64(void* memory, uint64_t v) {
|
| + Set8(memory, 0, static_cast<uint8_t>(v >> 0));
|
| + Set8(memory, 1, static_cast<uint8_t>(v >> 8));
|
| + Set8(memory, 2, static_cast<uint8_t>(v >> 16));
|
| + Set8(memory, 3, static_cast<uint8_t>(v >> 24));
|
| + Set8(memory, 4, static_cast<uint8_t>(v >> 32));
|
| + Set8(memory, 5, static_cast<uint8_t>(v >> 40));
|
| + Set8(memory, 6, static_cast<uint8_t>(v >> 48));
|
| + Set8(memory, 7, static_cast<uint8_t>(v >> 56));
|
| }
|
|
|
| -inline uint16 GetLE16(const void* memory) {
|
| - return static_cast<uint16>((Get8(memory, 0) << 0) |
|
| - (Get8(memory, 1) << 8));
|
| +inline uint16_t GetLE16(const void* memory) {
|
| + return static_cast<uint16_t>((Get8(memory, 0) << 0) | (Get8(memory, 1) << 8));
|
| }
|
|
|
| -inline uint32 GetLE32(const void* memory) {
|
| - return (static_cast<uint32>(Get8(memory, 0)) << 0) |
|
| - (static_cast<uint32>(Get8(memory, 1)) << 8) |
|
| - (static_cast<uint32>(Get8(memory, 2)) << 16) |
|
| - (static_cast<uint32>(Get8(memory, 3)) << 24);
|
| +inline uint32_t GetLE32(const void* memory) {
|
| + return (static_cast<uint32_t>(Get8(memory, 0)) << 0) |
|
| + (static_cast<uint32_t>(Get8(memory, 1)) << 8) |
|
| + (static_cast<uint32_t>(Get8(memory, 2)) << 16) |
|
| + (static_cast<uint32_t>(Get8(memory, 3)) << 24);
|
| }
|
|
|
| -inline uint64 GetLE64(const void* memory) {
|
| - return (static_cast<uint64>(Get8(memory, 0)) << 0) |
|
| - (static_cast<uint64>(Get8(memory, 1)) << 8) |
|
| - (static_cast<uint64>(Get8(memory, 2)) << 16) |
|
| - (static_cast<uint64>(Get8(memory, 3)) << 24) |
|
| - (static_cast<uint64>(Get8(memory, 4)) << 32) |
|
| - (static_cast<uint64>(Get8(memory, 5)) << 40) |
|
| - (static_cast<uint64>(Get8(memory, 6)) << 48) |
|
| - (static_cast<uint64>(Get8(memory, 7)) << 56);
|
| +inline uint64_t GetLE64(const void* memory) {
|
| + return (static_cast<uint64_t>(Get8(memory, 0)) << 0) |
|
| + (static_cast<uint64_t>(Get8(memory, 1)) << 8) |
|
| + (static_cast<uint64_t>(Get8(memory, 2)) << 16) |
|
| + (static_cast<uint64_t>(Get8(memory, 3)) << 24) |
|
| + (static_cast<uint64_t>(Get8(memory, 4)) << 32) |
|
| + (static_cast<uint64_t>(Get8(memory, 5)) << 40) |
|
| + (static_cast<uint64_t>(Get8(memory, 6)) << 48) |
|
| + (static_cast<uint64_t>(Get8(memory, 7)) << 56);
|
| }
|
|
|
| // Check if the current host is big endian.
|
| @@ -133,33 +131,33 @@ inline bool IsHostBigEndian() {
|
| return 0 == *reinterpret_cast<const char*>(&number);
|
| }
|
|
|
| -inline uint16 HostToNetwork16(uint16 n) {
|
| - uint16 result;
|
| +inline uint16_t HostToNetwork16(uint16_t n) {
|
| + uint16_t result;
|
| SetBE16(&result, n);
|
| return result;
|
| }
|
|
|
| -inline uint32 HostToNetwork32(uint32 n) {
|
| - uint32 result;
|
| +inline uint32_t HostToNetwork32(uint32_t n) {
|
| + uint32_t result;
|
| SetBE32(&result, n);
|
| return result;
|
| }
|
|
|
| -inline uint64 HostToNetwork64(uint64 n) {
|
| - uint64 result;
|
| +inline uint64_t HostToNetwork64(uint64_t n) {
|
| + uint64_t result;
|
| SetBE64(&result, n);
|
| return result;
|
| }
|
|
|
| -inline uint16 NetworkToHost16(uint16 n) {
|
| +inline uint16_t NetworkToHost16(uint16_t n) {
|
| return GetBE16(&n);
|
| }
|
|
|
| -inline uint32 NetworkToHost32(uint32 n) {
|
| +inline uint32_t NetworkToHost32(uint32_t n) {
|
| return GetBE32(&n);
|
| }
|
|
|
| -inline uint64 NetworkToHost64(uint64 n) {
|
| +inline uint64_t NetworkToHost64(uint64_t n) {
|
| return GetBE64(&n);
|
| }
|
|
|
|
|