MCPcopy Create free account
hub / github.com/apache/kvrocks / EncodeDoubleToUInt64

Function EncodeDoubleToUInt64

src/common/encoding.cc:32–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30#include <utility>
31
32inline uint64_t EncodeDoubleToUInt64(double value) {
33 uint64_t result = 0;
34
35 __builtin_memcpy(&result, &value, sizeof(value));
36
37 if ((result >> 63) == 1) {
38 // signed bit would be zero
39 result ^= 0xffffffffffffffff;
40 } else {
41 // signed bit would be one
42 result |= 0x8000000000000000;
43 }
44
45 return result;
46}
47
48inline double DecodeDoubleFromUInt64(uint64_t value) {
49 if ((value >> 63) == 0) {

Callers 2

EncodeDoubleFunction · 0.85
PutDoubleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected