| 70 | } |
| 71 | |
| 72 | inline uint64_t DecodeFixed64(const char* ptr) { |
| 73 | if (port::kLittleEndian) { |
| 74 | // Load the raw bytes |
| 75 | uint64_t result; |
| 76 | memcpy(&result, ptr, sizeof(result)); // gcc optimizes this to a plain load |
| 77 | return result; |
| 78 | } else { |
| 79 | uint64_t lo = DecodeFixed32(ptr); |
| 80 | uint64_t hi = DecodeFixed32(ptr + 4); |
| 81 | return (hi << 32) | lo; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | // Internal routine for use by fallback path of GetVarint32Ptr |
| 86 | extern const char* GetVarint32PtrFallback(const char* p, |