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

Function FillInArray

cpp/src/arrow/util/basic_decimal.cc:650–671  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648/// \result the output length of the array
649template <size_t N>
650static int64_t FillInArray(const std::array<uint64_t, N>& value_array,
651 uint32_t* result_array) {
652 const auto value_array_le = bit_util::little_endian::Make(value_array);
653 int64_t next_index = 0;
654 // 1st loop to find out 1st non-negative value in input
655 int64_t i = N - 1;
656 for (; i >= 0; i--) {
657 if (value_array_le[i] != 0) {
658 if (value_array_le[i] <= std::numeric_limits<uint32_t>::max()) {
659 result_array[next_index++] = static_cast<uint32_t>(value_array_le[i]);
660 i--;
661 }
662 break;
663 }
664 }
665 // 2nd loop to fill in the rest of the array.
666 for (int64_t j = i; j >= 0; j--) {
667 result_array[next_index++] = static_cast<uint32_t>(value_array_le[j] >> 32);
668 result_array[next_index++] = static_cast<uint32_t>(value_array_le[j]);
669 }
670 return next_index;
671}
672
673/// Expands the given value into a big endian array of ints so that we can work on
674/// it. The array will be converted to an absolute value and the was_negative

Callers 1

DecimalDivideFunction · 0.85

Calls 4

IsNegativeMethod · 0.80
NegateMethod · 0.80
MakeFunction · 0.70
AbsFunction · 0.70

Tested by

no test coverage detected