Bei-z commented on a change in pull request #8542: URL: https://github.com/apache/arrow/pull/8542#discussion_r520841121
########## File path: cpp/src/arrow/util/basic_decimal.cc ########## @@ -451,6 +467,25 @@ static int64_t FillInArray(const BasicDecimal128& value, uint32_t* array, return 1; } +/// Expands the given value into a big endian array of ints so that we can work on +/// it. The array will be converted to an absolute value and the was_negative +/// flag will be set appropriately. The array will remove leading zeros from +/// the value. +/// \param array a big endian array of length 8 to set with the value +/// \param was_negative a flag for whether the value was original negative +/// \result the output length of the array +static int64_t FillInArray(const BasicDecimal256& value, uint32_t* array, + bool& was_negative) { + BasicDecimal256 positive_value = value; + was_negative = false; + int64_t highest_bit = positive_value.little_endian_array()[3]; + if (highest_bit < 0) { Review comment: BasicDecimal256 do have a sign method, but that method need shifting of int64_t value. Added the IsNegavie method. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org