Skip to content

Commit

Permalink
Tweaked: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
richardbiely committed Oct 11, 2024
1 parent 6de152e commit be9356c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/gaia/ecs/archetype_graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ namespace gaia {

private:
void add_edge(EdgeMap& edges, Entity entity, ArchetypeId archetypeId, ArchetypeIdHash hash) {
#if !GAIA_DISABLE_ASSERTS
#if GAIA_ASSERT_ENABLED
const auto ret =
#endif
edges.try_emplace(EntityLookupKey(entity), ArchetypeGraphEdge{archetypeId, hash});
#if !GAIA_DISABLE_ASSERTS
#if GAIA_ASSERT_ENABLED
// If the result already exists make sure the new one is the same
if (!ret.second) {
const auto it = edges.find(EntityLookupKey(entity));
Expand Down
2 changes: 1 addition & 1 deletion include/gaia/ecs/system.inl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace gaia {

auto& ctx = data();
if constexpr (std::is_invocable_v<Func, Iter&>) {
ctx.on_each_func = [this, func](Iter& it) {
ctx.on_each_func = [func](Iter& it) {
GAIA_PROF_SCOPE(query_func);
func(it);
};
Expand Down
4 changes: 2 additions & 2 deletions single_include/gaia.h
Original file line number Diff line number Diff line change
Expand Up @@ -16112,11 +16112,11 @@ namespace gaia {

private:
void add_edge(EdgeMap& edges, Entity entity, ArchetypeId archetypeId, ArchetypeIdHash hash) {
#if !GAIA_DISABLE_ASSERTS
#if GAIA_ASSERT_ENABLED
const auto ret =
#endif
edges.try_emplace(EntityLookupKey(entity), ArchetypeGraphEdge{archetypeId, hash});
#if !GAIA_DISABLE_ASSERTS
#if GAIA_ASSERT_ENABLED
// If the result already exists make sure the new one is the same
if (!ret.second) {
const auto it = edges.find(EntityLookupKey(entity));
Expand Down
1 change: 1 addition & 0 deletions src/perf/duel/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,7 @@ void BM_NonECS_BetterMemoryLayout(picobench::state& state) {
}
units_dynamic3[0].isAlive_verify();
units_dynamic4[0].isAlive_verify();
gaia::dont_optimize(aliveUnits);
}

GAIA_PROF_FRAME();
Expand Down
15 changes: 9 additions & 6 deletions src/test/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ struct TypeNonTrivial {

static constexpr const char* StringComponentDefaultValue =
"StringComponentDefaultValue_ReasonablyLongSoThatItShouldCauseAHeapAllocationOnAllStdStringImplementations";
static constexpr const char* StringComponentDefaultValue_2 =
"2_StringComponentDefaultValue_ReasonablyLongSoThatItShouldCauseAHeapAllocationOnAllStdStringImplementations";
static constexpr const char* StringComponent2DefaultValue =
"StringComponent2DefaultValue_ReasonablyLongSoThatItShouldCauseAHeapAllocationOnAllStdStringImplementations";
static constexpr const char* StringComponent2DefaultValue_2 =
Expand Down Expand Up @@ -875,8 +873,6 @@ void sparse_storage_test(uint32_t N) {

template <typename Container>
void sparse_storage_test_tag(uint32_t N) {
using cont_item = typename Container::value_type;

constexpr uint32_t CONV = 100;
auto to_sid = [](uint32_t i) {
return i * CONV;
Expand Down Expand Up @@ -928,7 +924,7 @@ void sparse_storage_test_tag(uint32_t N) {
}

uint32_t cnt = 0;
for (auto val: arr) {
for (const auto& val: arr) {
REQUIRE(val == to_sid(cnt));
++cnt;
}
Expand Down Expand Up @@ -2045,6 +2041,11 @@ TEST_CASE("Run-time sort - quick sort") {
sort_ascending<true>(cnt::sarray<uint32_t, 45>{});
}

GAIA_GCC_WARNING_PUSH()
GAIA_GCC_WARNING_DISABLE("-Wmissing-field-initializers")
GAIA_CLANG_WARNING_PUSH()
GAIA_CLANG_WARNING_DISABLE("-Wmissing-field-initializers")

template <typename T>
void TestDataLayoutAoS() {
constexpr uint32_t N = 100;
Expand Down Expand Up @@ -2190,6 +2191,9 @@ TEST_CASE("DataLayout SoA16") {
TestDataLayoutSoA<RotationSoA16>();
}

GAIA_CLANG_WARNING_POP()
GAIA_GCC_WARNING_POP()

TEST_CASE("Entity - valid/has") {
TestWorld twld;

Expand Down Expand Up @@ -7707,7 +7711,6 @@ TEST_CASE("Delegates") {
TestWorld twld;
auto e1 = wld.add();
auto e2 = wld.add();
auto e3 = wld.add();

// free function
{
Expand Down

0 comments on commit be9356c

Please sign in to comment.