| 400 | |
| 401 | template <typename Int> |
| 402 | inline bool BitWriter::PutZigZagVlqInt(Int v) { |
| 403 | static_assert(std::is_integral_v<Int>); |
| 404 | static_assert(std::is_signed_v<Int>); |
| 405 | using UInt = std::make_unsigned_t<Int>; |
| 406 | constexpr auto kBitSize = 8 * sizeof(Int); |
| 407 | |
| 408 | UInt u_v = ::arrow::util::SafeCopy<UInt>(v); |
| 409 | u_v = (u_v << 1) ^ static_cast<UInt>(v >> (kBitSize - 1)); |
| 410 | return PutVlqInt(u_v); |
| 411 | } |
| 412 | |
| 413 | template <typename Int> |
| 414 | inline bool BitReader::GetZigZagVlqInt(Int* v) { |
no outgoing calls