summaryrefslogtreecommitdiffhomepage
path: root/serialize/packbits-impl.hpp
blob: 3e57ea758f0182943ea2b08b021b2c56f6843bdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#pragma once

namespace floormat::Pack_impl {

[[noreturn]] void throw_on_read_nonzero() noexcept(false);
[[noreturn]] void throw_on_write_input_bit_overflow() noexcept(false);

template<size_t... Ns> struct expand_sum;
template<size_t N, size_t... Ns> struct expand_sum<N, Ns...> { static constexpr size_t value = N + expand_sum<Ns...>::value; };
template<> struct expand_sum<> { static constexpr size_t value = 0; };
template<size_t... Ns> constexpr inline size_t sum = expand_sum<Ns...>::value;

} // namespace floormat::Pack_impl