Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions ci/msvc-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ cd ..\..\python
python setup.py build_ext --inplace || exit /B
python -c "import pyarrow" || exit /B

@rem TODO: re-enable when last tests are fixed
@rem py.test pyarrow -v -s || exit /B
py.test pyarrow -v -s || exit /B
8 changes: 4 additions & 4 deletions cpp/src/arrow/util/decimal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ void FromBytes(const uint8_t* bytes, Decimal64* decimal) {
constexpr static const size_t BYTES_IN_128_BITS = 128 / CHAR_BIT;
constexpr static const size_t LIMB_SIZE =
sizeof(std::remove_pointer<int128_t::backend_type::limb_pointer>::type);
constexpr static const size_t BYTES_PER_LIMB = BYTES_IN_128_BITS / LIMB_SIZE;
constexpr static const size_t LIMBS_IN_INT128 = BYTES_IN_128_BITS / LIMB_SIZE;

void FromBytes(const uint8_t* bytes, bool is_negative, Decimal128* decimal) {
DCHECK_NE(bytes, nullptr);
DCHECK_NE(decimal, nullptr);

auto& decimal_value(decimal->value);
int128_t::backend_type& backend(decimal_value.backend());
backend.resize(BYTES_PER_LIMB, BYTES_PER_LIMB);
backend.resize(LIMBS_IN_INT128, LIMBS_IN_INT128);
std::memcpy(backend.limbs(), bytes, BYTES_IN_128_BITS);
if (is_negative) { decimal->value = -decimal->value; }
}
Expand All @@ -177,8 +177,8 @@ void ToBytes(const Decimal128& decimal, uint8_t** bytes, bool* is_negative) {
/// TODO(phillipc): boost multiprecision is unreliable here, int128_t can't be
/// roundtripped
const auto& backend(decimal.value.backend());
auto boost_bytes = reinterpret_cast<const uint8_t*>(backend.limbs());
std::memcpy(*bytes, boost_bytes, BYTES_IN_128_BITS);
const size_t bytes_in_use = LIMB_SIZE * backend.size();
std::memcpy(*bytes, backend.limbs(), bytes_in_use);
*is_negative = backend.isneg();
}

Expand Down