From 0c5da927bb761f28ef3f9e62bb6fac3e88e406c2 Mon Sep 17 00:00:00 2001 From: Kazuaki Ishizaki Date: Mon, 16 Nov 2020 09:22:40 +0000 Subject: [PATCH] support float copy value on big-endian --- cpp/src/arrow/vendored/fast_float/parse_number.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpp/src/arrow/vendored/fast_float/parse_number.h b/cpp/src/arrow/vendored/fast_float/parse_number.h index f27a6d82f91..2a31b8b2618 100644 --- a/cpp/src/arrow/vendored/fast_float/parse_number.h +++ b/cpp/src/arrow/vendored/fast_float/parse_number.h @@ -10,6 +10,8 @@ #include #include +#include "arrow/util/bit_util.h" + namespace arrow_vendored { namespace fast_float { @@ -108,6 +110,11 @@ from_chars_result from_chars(const char *first, const char *last, word |= uint64_t(am.power2) << binary_format::mantissa_explicit_bits(); word = pns.negative ? word | (uint64_t(1) << binary_format::sign_index()) : word; +#if ARROW_LITTLE_ENDIAN == 0 + if (std::is_same::value) { + memcpy(&value, (char *)&word + 4, sizeof(T)); // extract value at offset 4-7 if float on big-endian + } else +#endif memcpy(&value, &word, sizeof(T)); return answer; }