| 778 | /// \brief Build a native endian array of uint64_t from a big endian array of uint32_t. |
| 779 | template <size_t N> |
| 780 | static DecimalStatus BuildFromArray(std::array<uint64_t, N>* result_array, |
| 781 | const uint32_t* array, int64_t length) { |
| 782 | for (int64_t i = length - 2 * N - 1; i >= 0; i--) { |
| 783 | if (array[i] != 0) { |
| 784 | return DecimalStatus::kOverflow; |
| 785 | } |
| 786 | } |
| 787 | int64_t next_index = length - 1; |
| 788 | size_t i = 0; |
| 789 | auto result_array_le = bit_util::little_endian::Make(result_array); |
| 790 | for (; i < N && next_index >= 0; i++) { |
| 791 | uint64_t lower_bits = array[next_index--]; |
| 792 | result_array_le[i] = |
| 793 | (next_index < 0) |
| 794 | ? lower_bits |
| 795 | : ((static_cast<uint64_t>(array[next_index--]) << 32) + lower_bits); |
| 796 | } |
| 797 | for (; i < N; i++) { |
| 798 | result_array_le[i] = 0; |
| 799 | } |
| 800 | return DecimalStatus::kSuccess; |
| 801 | } |
| 802 | |
| 803 | /// \brief Build a BasicDecimal128 from a big endian array of uint32_t. |
| 804 | static DecimalStatus BuildFromArray(BasicDecimal128* value, const uint32_t* array, |
no test coverage detected