MCPcopy Create free account
hub / github.com/apache/arrow / UInt64FromBigEndian

Function UInt64FromBigEndian

cpp/src/arrow/util/decimal.cc:1091–1102  ·  view source on GitHub ↗

Helper function used by Decimal128::FromBigEndian

Source from the content-addressed store, hash-verified

1089
1090// Helper function used by Decimal128::FromBigEndian
1091static inline uint64_t UInt64FromBigEndian(const uint8_t* bytes, int32_t length) {
1092 // We don't bounds check the length here because this is called by
1093 // FromBigEndian that has a Decimal128 as its out parameters and
1094 // that function is already checking the length of the bytes and only
1095 // passes lengths between zero and eight.
1096 uint64_t result = 0;
1097 // Using memcpy instead of special casing for length
1098 // and doing the conversion in 16, 32 parts, which could
1099 // possibly create unaligned memory access on certain platforms
1100 memcpy(reinterpret_cast<uint8_t*>(&result) + 8 - length, bytes, length);
1101 return ::arrow::bit_util::FromBigEndian(result);
1102}
1103
1104Result<Decimal32> Decimal32::FromBigEndian(const uint8_t* bytes, int32_t length) {
1105 static constexpr int32_t kMinDecimalBytes = 1;

Callers 1

FromBigEndianMethod · 0.85

Calls 1

FromBigEndianFunction · 0.70

Tested by

no test coverage detected