MCPcopy Create free account
hub / github.com/ElementsProject/elements / DecodeFixed64

Function DecodeFixed64

src/leveldb/util/coding.h:124–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122}
123
124inline uint64_t DecodeFixed64(const char* ptr) {
125 const uint8_t* const buffer = reinterpret_cast<const uint8_t*>(ptr);
126
127 if (port::kLittleEndian) {
128 // Fast path for little-endian CPUs. All major compilers optimize this to a
129 // single mov (x86_64) / ldr (ARM) instruction.
130 uint64_t result;
131 std::memcpy(&result, buffer, sizeof(uint64_t));
132 return result;
133 }
134
135 // Platform-independent code.
136 // Clang and gcc optimize this to a single mov / ldr instruction.
137 return (static_cast<uint64_t>(buffer[0])) |
138 (static_cast<uint64_t>(buffer[1]) << 8) |
139 (static_cast<uint64_t>(buffer[2]) << 16) |
140 (static_cast<uint64_t>(buffer[3]) << 24) |
141 (static_cast<uint64_t>(buffer[4]) << 32) |
142 (static_cast<uint64_t>(buffer[5]) << 40) |
143 (static_cast<uint64_t>(buffer[6]) << 48) |
144 (static_cast<uint64_t>(buffer[7]) << 56);
145}
146
147// Internal routine for use by fallback path of GetVarint32Ptr
148const char* GetVarint32PtrFallback(const char* p, const char* limit,

Callers 6

TESTFunction · 0.85
GetMethod · 0.85
SequenceMethod · 0.85
ParseInternalKeyFunction · 0.85
GetFileIteratorFunction · 0.85
CompareMethod · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68