| 65 | // without any bounds checking. |
| 66 | |
| 67 | inline uint32_t DecodeFixed32(const uint8_t *ptr) { |
| 68 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 69 | // Load the raw bytes |
| 70 | uint32_t result; |
| 71 | memcpy(&result, ptr, sizeof(result)); // gcc optimizes this to a plain load |
| 72 | return result; |
| 73 | #else |
| 74 | return ((static_cast<uint32_t>(static_cast<unsigned char>(ptr[0]))) |
| 75 | | (static_cast<uint32_t>(static_cast<unsigned char>(ptr[1])) << 8) |
| 76 | | (static_cast<uint32_t>(static_cast<unsigned char>(ptr[2])) << 16) |
| 77 | | (static_cast<uint32_t>(static_cast<unsigned char>(ptr[3])) << 24)); |
| 78 | #endif |
| 79 | } |
| 80 | |
| 81 | inline uint64_t DecodeFixed64(const uint8_t *ptr) { |
| 82 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
no outgoing calls