summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--compat/safe-ptr.hpp1
-rw-r--r--draw/anim.hpp1
-rw-r--r--serialize/packbits-write.cpp10
-rw-r--r--serialize/packbits-write.hpp10
-rw-r--r--src/chunk.hpp1
5 files changed, 13 insertions, 10 deletions
diff --git a/compat/safe-ptr.hpp b/compat/safe-ptr.hpp
index f6b0b260..5f513f82 100644
--- a/compat/safe-ptr.hpp
+++ b/compat/safe-ptr.hpp
@@ -24,6 +24,7 @@ public:
explicit safe_ptr(T*&& ptr) noexcept: ptr{ptr}
{
fm_assert(ptr != nullptr);
+ ptr = nullptr;
}
~safe_ptr() noexcept
diff --git a/draw/anim.hpp b/draw/anim.hpp
index 54fffd38..c9420eb4 100644
--- a/draw/anim.hpp
+++ b/draw/anim.hpp
@@ -3,6 +3,7 @@
#include "src/rotation.hpp"
#include "src/chunk.hpp"
#include <array>
+#include <vector>
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/ArrayView.h>
#include <Magnum/Magnum.h>
diff --git a/serialize/packbits-write.cpp b/serialize/packbits-write.cpp
index 84126ea4..76b1398a 100644
--- a/serialize/packbits-write.cpp
+++ b/serialize/packbits-write.cpp
@@ -7,17 +7,17 @@ using u8 = uint8_t;
template<size_t N> using f32 = output_field<u32, N>;
template<size_t N> using f8 = output_field<u8, N>;
-static_assert(count_bits<u32, std::tuple< f32<2>, f32<3>, f32<5>> >::length == 10);
-static_assert(count_bits<u8, std::tuple<>>::length == 0);
-//static_assert(count_bits<u8, std::tuple<f8<9>>>::length == 0);
+static_assert(count_bits<u32, std::tuple< f32<2>, f32<3>, f32<5> >> == 10);
+static_assert(count_bits<uint8_t, std::tuple< f8<1>, f8<2>, f8<4> >> == 7);
+static_assert(count_bits<u8, std::tuple<>> == 0);
+//static_assert(count_bits<u8, std::tuple< f8<9> >> == 0);
+//static_assert(count_bits<u8, std::tuple< f8<7>, f8<2> >> == 9);
template u32 write_(output<u32, 32>, std::index_sequence<0>, const std::tuple<f32<1>>&);
static_assert(output<u32, 32>::next<1>::Capacity == 31);
static_assert(output<u32, 32>::next<1>::next<2>::Capacity == 29);
-template<size_t N> using f32 = output_field<u32, N>;
-
#if 0
static_assert(write_(output<u32, 32>{0},
f32<2>{0b10},
diff --git a/serialize/packbits-write.hpp b/serialize/packbits-write.hpp
index c62b8e39..8bcd14af 100644
--- a/serialize/packbits-write.hpp
+++ b/serialize/packbits-write.hpp
@@ -56,20 +56,22 @@ struct output_field
static constexpr size_t Length = LENGTH;
};
-template<std::unsigned_integral Type, typename Tuple> struct count_bits;
+template<std::unsigned_integral Type, typename Tuple> struct count_bits_;
-template<std::unsigned_integral Int, size_t N, typename... Ts> struct count_bits<Int, std::tuple<output_field<Int, N>, Ts...>>
+template<std::unsigned_integral Int, size_t N, typename... Ts> struct count_bits_<Int, std::tuple<output_field<Int, N>, Ts...>>
{
- static constexpr size_t length = N + count_bits<Int, std::tuple<Ts...>>::length;
+ static constexpr size_t length = N + count_bits_<Int, std::tuple<Ts...>>::length;
static_assert(length <= sizeof(Int)*8);
};
-template<std::unsigned_integral Int> struct count_bits<Int, std::tuple<>>
+template<std::unsigned_integral Int> struct count_bits_<Int, std::tuple<>>
{
static constexpr size_t length = 0;
};
+template<typename T, typename Tuple> constexpr inline size_t count_bits = count_bits_<T, Tuple>::length;
+
template <std::size_t ... Is>
constexpr std::index_sequence<sizeof...(Is)-1uz-Is...> reverse_index_sequence(std::index_sequence<Is...> const&);
diff --git a/src/chunk.hpp b/src/chunk.hpp
index 064a16e7..968be089 100644
--- a/src/chunk.hpp
+++ b/src/chunk.hpp
@@ -7,7 +7,6 @@
#include "wall-defs.hpp"
#include <type_traits>
#include <array>
-#include <vector>
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/Pointer.h>
#include <Magnum/GL/Mesh.h>