add src/ikarus subdir and make names unique for objects per scope

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
folling 2024-01-30 09:31:08 +01:00 committed by Folling
parent ced123b628
commit 9f943cc6a2
Signed by: folling
SSH key fingerprint: SHA256:S9qEx5WCFFLK49tE/LKnKuJYM5sw+++Dn6qJbbyxnCY
51 changed files with 590 additions and 735 deletions

14
src/ikarus/id.cpp Normal file
View file

@ -0,0 +1,14 @@
#include "ikarus/id.h"
#include <ikarus/objects/object_type.h>
constexpr uint64_t IKARUS_ID_OBJECT_TYPE_BITS = 8;
constexpr uint64_t IKARUS_ID_OBJECT_RANDOM_BITS = sizeof(IkarusId) - IKARUS_ID_OBJECT_TYPE_BITS;
auto ikarus_id_from_data_and_type(int64_t data, IkarusObjectType type) -> IkarusId {
return data | (static_cast<IkarusId>(type) << IKARUS_ID_OBJECT_RANDOM_BITS);
}
auto ikarus_id_get_object_type(IkarusId id) -> IkarusObjectType {
return static_cast<IkarusObjectType>(id >> IKARUS_ID_OBJECT_RANDOM_BITS);
}