From 5eb90d7e9cd9338265c2d91991047fe519034f15 Mon Sep 17 00:00:00 2001 From: benibus Date: Tue, 14 Nov 2023 12:36:46 -0500 Subject: [PATCH] Tweak ToEndian methods --- cpp/src/arrow/util/float16.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/util/float16.h b/cpp/src/arrow/util/float16.h index 888936797c870..0a432fee2cd31 100644 --- a/cpp/src/arrow/util/float16.h +++ b/cpp/src/arrow/util/float16.h @@ -106,7 +106,8 @@ class ARROW_EXPORT Float16 { /// \brief Copy the value's bytes in little-endian byte order void ToLittleEndian(uint8_t* dest) const { - FromBits(::arrow::bit_util::ToLittleEndian(bits_)).ToBytes(dest); + const auto bytes = ToLittleEndian(); + std::memcpy(dest, bytes.data(), bytes.size()); } /// \brief Return the value's bytes in little-endian byte order constexpr std::array ToLittleEndian() const { @@ -119,7 +120,8 @@ class ARROW_EXPORT Float16 { /// \brief Copy the value's bytes in big-endian byte order void ToBigEndian(uint8_t* dest) const { - FromBits(::arrow::bit_util::ToBigEndian(bits_)).ToBytes(dest); + const auto bytes = ToBigEndian(); + std::memcpy(dest, bytes.data(), bytes.size()); } /// \brief Return the value's bytes in big-endian byte order constexpr std::array ToBigEndian() const {