bkietz commented on a change in pull request #10823:
URL: https://github.com/apache/arrow/pull/10823#discussion_r679930351
##########
File path: cpp/src/arrow/util/basic_decimal.h
##########
@@ -54,6 +61,20 @@ class ARROW_EXPORT BasicDecimal128 {
: high_bits_(high), low_bits_(low) {}
#endif
+ /// \brief Create a BasicDecimal256 from the two's complement representation.
+ /// Input array is assumed to be in native endianness.
+#if ARROW_LITTLE_ENDIAN
+ constexpr BasicDecimal128(const std::array<uint64_t, 2>& array) noexcept
+ : low_bits_(array[0]), high_bits_(static_cast<int64_t>(array[1])) {}
+#else
+ constexpr BasicDecimal128(const std::array<uint64_t, 2>& array) noexcept
+ : high_bits_(static_cast<int64_t>(array[0])), low_bits_(array[1]) {}
+#endif
+
+ // XXX
+ BasicDecimal128(LittleEndianArrayTag, const std::array<uint64_t, 2>& array)
noexcept
+ : BasicDecimal128(BitUtil::LittleEndianArray::ToNative(array)) {}
Review comment:
I'd say it's not idiomatic arrow; I'd expect something like:
```suggestion
static BasicDecimal128 FromLittleEndianArray(const std::array<uint64_t,
2>& array) noexcept {
return {BitUtil::LittleEndianArray::ToNative(array)};
}
```
... but then we'll have to repeat the declaration for non Basic decimal
types.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]