Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): only compile correct version code #674

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions core/src/cubos/core/ecs/entity/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ std::size_t EntityHash::operator()(const Entity& entity) const noexcept
// for entities with the same index but different generations. That shouldn't be a problem
// though, since that use case is very unlikely.

if constexpr (sizeof(std::size_t) < sizeof(uint32_t) * 2)
{
return static_cast<std::size_t>(entity.index);
}

#if SIZE_MAX <= UINT32_MAX
return static_cast<std::size_t>(entity.index);
#else
static_assert(sizeof(std::size_t) >= sizeof(uint32_t) * 2);
return static_cast<std::size_t>(entity.index) |
(static_cast<std::size_t>(entity.generation) << (sizeof(uint32_t) * 8));
#endif
}
Loading