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 2020/05/29 13:55:56 UTC

[GitHub] [arrow] fsaintjacques commented on a change in pull request #7256: ARROW-8914: [C++] Keep BasicDecimal128 in native-endian order

fsaintjacques commented on a change in pull request #7256:
URL: https://github.com/apache/arrow/pull/7256#discussion_r432488488



##########
File path: cpp/src/arrow/util/basic_decimal.cc
##########
@@ -139,8 +144,13 @@ std::array<uint8_t, 16> BasicDecimal128::ToBytes() const {
 
 void BasicDecimal128::ToBytes(uint8_t* out) const {
   DCHECK_NE(out, nullptr);
-  reinterpret_cast<uint64_t*>(out)[0] = BitUtil::ToLittleEndian(low_bits_);
-  reinterpret_cast<int64_t*>(out)[1] = BitUtil::ToLittleEndian(high_bits_);
+#if ARROW_LITTLE_ENDIAN
+  reinterpret_cast<uint64_t*>(out)[0] = low_bits_;

Review comment:
       You could replace this with the SafeLoad/SafeStore functions.




----------------------------------------------------------------
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:
users@infra.apache.org