Introduce the JabyEngine namespace to all files

This commit is contained in:
2022-12-23 21:18:25 +01:00
parent 791fe85ab8
commit def6c6d3b9
27 changed files with 1320 additions and 1282 deletions

View File

@@ -0,0 +1,36 @@
#ifndef __JABYENGINE__HPP__
#define __JABYENGINE__HPP__
#include "../stdint.h"
namespace JabyEngine {
struct NextRoutine {
static constexpr uintptr_t OverlayBit = (1 << ((sizeof(uintptr_t)*8) - 2));
typedef NextRoutine (*MainRoutine)();
uintptr_t value;
constexpr static NextRoutine null() {
return {.value = 0};
}
static NextRoutine from(MainRoutine function) {
return {.value = reinterpret_cast<uintptr_t>(function)};
}
constexpr bool is_overlay() const {
return (this->value & OverlayBit);
}
constexpr bool is_absolute() const {
return !NextRoutine::is_overlay();
}
constexpr bool is_null() const {
return this->value == 0;
}
};
typedef NextRoutine::MainRoutine MainRoutine;
}
#endif //!__JABYENGINE__HPP__