Skip to content

Commit 8f67f76

Browse files
committed
MSVC: Hide unpack_detect in class
1 parent bbfc25f commit 8f67f76

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

cpp/src/arrow/util/bit_stream_utils_internal.h

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,20 @@ class BitReader {
181181
}
182182

183183
private:
184+
template <typename T>
185+
186+
struct unpack_detect {
187+
using type = std::make_unsigned_t<T>;
188+
};
189+
190+
template <>
191+
struct unpack_detect<bool> {
192+
using type = uint8_t;
193+
};
194+
195+
template <typename T>
196+
using unpack_t = typename unpack_detect<T>::type;
197+
184198
const uint8_t* buffer_;
185199
int max_bytes_;
186200

@@ -296,18 +310,6 @@ inline bool BitReader::GetValue(int num_bits, T* v) {
296310
return GetBatch(num_bits, v, 1) == 1;
297311
}
298312

299-
namespace internal {
300-
template <typename T>
301-
struct unpack_detect {
302-
using type = std::make_unsigned_t<T>;
303-
};
304-
305-
template <>
306-
struct unpack_detect<bool> {
307-
using type = uint8_t;
308-
};
309-
} // namespace internal
310-
311313
template <typename T>
312314
inline int BitReader::GetBatch(int num_bits, T* v, int batch_size) {
313315
ARROW_DCHECK(buffer_ != NULL);
@@ -335,10 +337,9 @@ inline int BitReader::GetBatch(int num_bits, T* v, int batch_size) {
335337
}
336338
}
337339

338-
using unpack_t = typename internal::unpack_detect<T>::type;
339-
340-
int num_unpacked = ::arrow::internal::unpack(
341-
buffer + byte_offset, reinterpret_cast<unpack_t*>(v + i), batch_size - i, num_bits);
340+
int num_unpacked = ::arrow::internal::unpack(buffer + byte_offset,
341+
reinterpret_cast<unpack_t<T>*>(v + i),
342+
batch_size - i, num_bits);
342343
i += num_unpacked;
343344
byte_offset += num_unpacked * num_bits / 8;
344345

0 commit comments

Comments
 (0)