Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
common.h
1#pragma once
2#include "gaia/config/config.h"
3
4#include <cstdint>
5
6namespace gaia {
7 namespace ecs {
8 GAIA_NODISCARD inline bool version_changed(uint32_t changeVersion, uint32_t requiredVersion) {
9 // When a system runs for the first time, everything is considered changed.
10 if GAIA_UNLIKELY (requiredVersion == 0U)
11 return true;
12
13 // Supporting wrap-around for version numbers. ChangeVersion must be
14 // bigger than requiredVersion (never detect change of something the
15 // system itself changed).
16 return (int)(changeVersion - requiredVersion) > 0;
17 }
18
19 inline void update_version(uint32_t& version) {
20 ++version;
21 // Handle wrap-around, 0 is reserved for systems that have never run.
22 if GAIA_UNLIKELY (version == 0U)
23 ++version;
24 }
25 } // namespace ecs
26} // namespace gaia
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9