diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-05-30 23:36:42 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-05-30 23:36:42 +0200 |
commit | 5755d4515599b934274dc28d9d4896bf7fe6f95b (patch) | |
tree | 28e4e0ce13925d3e437b62b25dee24bbe315af01 /serialize/world-writer.cpp | |
parent | 17772a53ea0a18f386721fc5c404f80f57dc8a00 (diff) |
serialize/save: simplify up some bit shifting
Diffstat (limited to 'serialize/world-writer.cpp')
-rw-r--r-- | serialize/world-writer.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/serialize/world-writer.cpp b/serialize/world-writer.cpp index 50ffe3fb..5620c782 100644 --- a/serialize/world-writer.cpp +++ b/serialize/world-writer.cpp @@ -330,10 +330,10 @@ void writer_state::serialize_scenery(const chunk& c, writer_t& s) const auto& e = *e_; fm_assert(s.bytes_written() + entity_size <= chunk_buf.size()); object_id oid = e.id; - fm_assert((oid & lowbits<60, object_id>) == oid); - static_assert(entity_type_BITS == 3); + fm_assert((oid & lowbits<60, object_id>) == e.id); const auto type = e.type(); - fm_assert(((entity_type_i)type & lowbits<entity_type_BITS, entity_type_i>) == (entity_type_i)type); + const auto type_ = (entity_type_i)type; + fm_assert(type_ == (type_ & lowbits<entity_type_BITS, entity_type_i>)); oid |= (object_id)type << 64 - entity_type_BITS; s << oid; const auto local = e.coord.local(); |