Skip to content

Commit

Permalink
Fix conflict and add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
zanmato1984 committed Feb 27, 2024
1 parent 4af89a5 commit aece9de
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cpp/src/arrow/array/data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ namespace {

template <typename offset_type>
BufferSpan OffsetsForScalar(uint8_t* scratch_space, offset_type value_size) {
auto* offsets = reinterpret_cast<offset_type*>(scratch_space);
// The scalar scratch space could be filled concurrently (with the same content), thus
// we use relaxed atomic stores. This consequently requires the size of the atomic to
// match the size of the offset type.
static_assert(sizeof(std::atomic<offset_type>) == sizeof(offset_type));
auto* offsets = reinterpret_cast<std::atomic<offset_type>*>(scratch_space);
offsets[0].store(0, std::memory_order_relaxed);
Expand All @@ -297,8 +299,9 @@ BufferSpan OffsetsForScalar(uint8_t* scratch_space, offset_type value_size) {
template <typename offset_type>
std::pair<BufferSpan, BufferSpan> OffsetsAndSizesForScalar(uint8_t* scratch_space,
offset_type value_size) {
auto* offsets = scratch_space;
auto* sizes = scratch_space + sizeof(offset_type);
// The scalar scratch space could be filled concurrently (with the same content), thus
// we use relaxed atomic stores. This consequently requires the size of the atomic to
// match the size of the offset type.
static_assert(sizeof(std::atomic<offset_type>) == sizeof(offset_type));
auto* offsets = reinterpret_cast<std::atomic<offset_type>*>(scratch_space);
auto* sizes = offsets + 1;
Expand Down

0 comments on commit aece9de

Please sign in to comment.