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

Function EncodeFixed64

src/leveldb/util/coding.h:80–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80inline void EncodeFixed64(char* dst, uint64_t value) {
81 uint8_t* const buffer = reinterpret_cast<uint8_t*>(dst);
82
83 if (port::kLittleEndian) {
84 // Fast path for little-endian CPUs. All major compilers optimize this to a
85 // single mov (x86_64) / str (ARM) instruction.
86 std::memcpy(buffer, &value, sizeof(uint64_t));
87 return;
88 }
89
90 // Platform-independent code.
91 // Currently, only gcc optimizes this to a single mov / str instruction.
92 buffer[0] = static_cast<uint8_t>(value);
93 buffer[1] = static_cast<uint8_t>(value >> 8);
94 buffer[2] = static_cast<uint8_t>(value >> 16);
95 buffer[3] = static_cast<uint8_t>(value >> 24);
96 buffer[4] = static_cast<uint8_t>(value >> 32);
97 buffer[5] = static_cast<uint8_t>(value >> 40);
98 buffer[6] = static_cast<uint8_t>(value >> 48);
99 buffer[7] = static_cast<uint8_t>(value >> 56);
100}
101
102// Lower-level versions of Get... that read directly from a character buffer
103// without any bounds checking.

Callers 8

BlockReaderMethod · 0.85
PutFixed64Function · 0.85
AddMethod · 0.85
FindTableMethod · 0.85
EvictMethod · 0.85
SetSequenceMethod · 0.85
valueMethod · 0.85
LookupKeyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected