From 6c30d003dfe391e186cc6e08bb00ec99532e5545 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 15 Jan 2024 09:33:30 +0100 Subject: a --- serialize/packbits.cpp | 114 ------------------------------------------------- 1 file changed, 114 deletions(-) delete mode 100644 serialize/packbits.cpp (limited to 'serialize/packbits.cpp') diff --git a/serialize/packbits.cpp b/serialize/packbits.cpp deleted file mode 100644 index e9ce54bc..00000000 --- a/serialize/packbits.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include "packbits-read.hpp" -#include "packbits-write.hpp" -#include "compat/assert.hpp" - -namespace floormat { - -using namespace floormat::detail_Pack_input; - -namespace { - -template constexpr inline T lowbits = (T{1} << N)-T{1}; - -static_assert(!input{65535}.check_zero()); -static_assert(input{65535}.advance<16>() == 0); - -static_assert(input::next<16>{ input{65535}.advance<16>() -}.check_zero()); -static_assert(input::next<16>{}.Capacity == 14); - -constexpr bool test1() -{ - constexpr size_t bits[] = { 5, 2, 1 }; - constexpr size_t vals[] = { 8, 3, 1, 0 }; - - constexpr auto S0 = input{0b10111011}; - constexpr auto S1 = input{0b00000101}; - constexpr auto S2 = input{0b00000001}; - constexpr auto S3 = input{0b00000000}; - - using P0 = std::decay_t; - using P1 = P0::next; - using P2 = P1::next; - using P3 = P2::next; - - static_assert(std::is_same_v>); - static_assert(std::is_same_v>); - static_assert(std::is_same_v>); - static_assert(std::is_same_v>); - - static_assert(S0.advance< 0>() == S0.value); - static_assert(S0.advance() == S1.value); - static_assert(S1.advance() == S2.value); - static_assert(S2.advance() == S3.value); - - static_assert(S0.get() == (S0.value & (1<() == (S1.value & (1<() == (S2.value & (1<{0b1110100110001011}; - constexpr auto S1 = input{0b1110}; - constexpr auto S2 = input{0b1}; - - static_assert(S0.get<12>() == 0b100110001011); - static_assert(S0.advance<12>() == S1.value); - - static_assert(S1.get<3>() == 0b110); - static_assert(S1.advance<3>() == S2.value); - - static_assert(S2.get<1>() == 0b1); - static_assert(S2.advance<1>() == 0); - - return true; -} -static_assert(test3()); - -static_assert(std::is_same_v< make_tuple_type, std::tuple >); - -constexpr bool test4() -{ - using Tuple_u32 = make_tuple_type; - static_assert(std::is_same_v>); - using Tuple_u8 = make_tuple_type; - { - Tuple_u32 tuple{}; - static_assert(lowbits == 0x1ffffU); - read(tuple, input{(uint32_t)-1}, std::make_index_sequence<3>{}, make_pack{}); - auto [a, b, c] = tuple; - fm_assert(a == lowbits); - fm_assert(b == lowbits); - fm_assert(c & 1); - } - { - Tuple_u8 tuple{}; - read(tuple, input{0b101011}, std::make_index_sequence<3>{}, make_pack{}); - auto [a, b, c] = tuple; - fm_assert(a == 0b1); - fm_assert(b == 0b101); - fm_assert(c == 0b10); - } - { - std::tuple<> empty_tuple; - read(empty_tuple, input{0}, std::index_sequence<>{}, make_pack{}); - Tuple_u8 tuple{}; (void)tuple; - //read(empty_tuple, input{1}, std::index_sequence<>{}, make_tuple{}); - //read(tuple, input{0b11111}, std::make_index_sequence<3>{}, make_tuple{}); - //(void)input{}; - //read(empty_tuple, input{}, std::index_sequence<0>{}, make_tuple{}); - //read(empty_tuple, input{1}, std::index_sequence<>{}, make_tuple{}); - } - - return true; -} -static_assert(test4()); - -} // namespace - -} // namespace floormat -- cgit v1.2.3