You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/08/02 09:32:56 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #10823: ARROW-9948: [C++] Fix scale handling in Decimal{128, 256}::FromString

pitrou commented on a change in pull request #10823:
URL: https://github.com/apache/arrow/pull/10823#discussion_r680820233



##########
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:
       Well, yes, having to repeat the declaration is the problem here.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org