summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-01-18 18:10:56 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-01-18 18:10:56 +0100
commit50ffcfd82d23c55f795882909bdf3ede37a51138 (patch)
tree383184f85ca5199e3614e8d3549e0a76ac4d3ab6
parent695b888d6599fdb13d300e7edfbb33eef7e0e47b (diff)
a
-rw-r--r--serialize/packbits-read.hpp4
-rw-r--r--serialize/packbits-write.hpp8
2 files changed, 6 insertions, 6 deletions
diff --git a/serialize/packbits-read.hpp b/serialize/packbits-read.hpp
index 39146bea..9c814d22 100644
--- a/serialize/packbits-read.hpp
+++ b/serialize/packbits-read.hpp
@@ -83,8 +83,8 @@ template<std::unsigned_integral T, typename Tuple, size_t Left, size_t I, size_t
constexpr CORRADE_ALWAYS_INLINE void read_(Tuple&& tuple, input<T, Left> st, std::index_sequence<I, Is...>)
{
using U = std::decay_t<Tuple>;
- static_assert(Left <= sizeof(T)*8, "too few bits to read into tuple");
- static_assert(Left > 0, "too few bytes in datatype");
+ static_assert(Left <= sizeof(T)*8, "bits to read count too large");
+ static_assert(Left > 0, "too many bits to write");
static_assert(std::tuple_size_v<U> >= sizeof...(Is)+1, "index count larger than tuple element count");
static_assert(I < std::tuple_size_v<U>, "too few tuple elements");
using Field = std::decay_t<std::tuple_element_t<I, U>>;
diff --git a/serialize/packbits-write.hpp b/serialize/packbits-write.hpp
index 12e202ac..7cece32b 100644
--- a/serialize/packbits-write.hpp
+++ b/serialize/packbits-write.hpp
@@ -35,13 +35,13 @@ template<std::unsigned_integral T, size_t Capacity, size_t Left, size_t I, size_
constexpr CORRADE_ALWAYS_INLINE T write_(const Tuple& tuple, output<T, Capacity, Left> st, std::index_sequence<I, Is...>)
{
static_assert(Capacity > 0);
- static_assert(Left > 0);
static_assert(Capacity <= sizeof(T)*8);
- static_assert(Left <= Capacity);
+ static_assert(Left > 0, "too many bits to write");
+ static_assert(Left <= Capacity, "too many bits to write");
static_assert(I < std::tuple_size_v<Tuple>, "too few tuple elements");
- static_assert(is_output_field<std::decay_t<decltype(std::get<I>(tuple))>>{});
+ static_assert(is_output_field<std::decay_t<decltype(std::get<I>(tuple))>>{}, "tuple element must be output<T,N>");
constexpr size_t N = std::tuple_element_t<I, Tuple>::Length;
- static_assert(N <= Left);
+ static_assert(N <= Left, "too many bits to write");
T x = std::get<I>(tuple).value;