MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / UnpackInteger

Function UnpackInteger

src/codec/memcomparable_format.h:222–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222__attribute__((unused)) static int UnpackInteger(const void *from,
223 uint32_t length,
224 bool unsigned_flag, void *to) {
225 if (from == nullptr || length < 2) {
226 return -1;
227 }
228 const uchar *ufrom = (uchar *)from; // NOLINT
229 uchar *uto = (uchar *)to; // NOLINT
230 const int sign_byte = ufrom[0];
231 if (unsigned_flag) {
232 uto[length - 1] = sign_byte;
233 } else {
234 uto[length - 1] =
235 static_cast<char>(sign_byte ^ 128); // Reverse the sign bit.
236 }
237 for (uint32_t i = 0, j = length - 1; i < length - 1; ++i, --j)
238 uto[i] = ufrom[j];
239 return 0;
240}
241
242__attribute__((unused)) static int UnpackFloatingPoint(
243 const void *src, const size_t size, const int exp_digit,

Callers 1

TEST_FFunction · 0.85

Calls

no outgoing calls

Tested by 1

TEST_FFunction · 0.68