summaryrefslogtreecommitdiffhomepage
path: root/Private/NewKit/Defines.hpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-19 10:05:31 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-19 10:05:31 +0100
commitbaf2afd8cd672dcb9c13d956dfdd73b61dfee558 (patch)
tree0734d2fe6d480e9805121e1c7d5e42f20bf4e8f4 /Private/NewKit/Defines.hpp
parent98347089c7e4e2b306d25a0db77e00aa2ea50882 (diff)
unstable, secret: See below.
System.Core: - Add RunTime init function. - Add ReadMe.md Kernel: - Improve TLS code, use Encoder class instead of casting directly. - Refactor process team to include processscheduler.hpp instead. ObjectKit: - Rename Object.hxx to ObjectKit.hxx Builtins/AHCI: - Rename API.hxx to Interface.hxx Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/NewKit/Defines.hpp')
-rw-r--r--Private/NewKit/Defines.hpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/Private/NewKit/Defines.hpp b/Private/NewKit/Defines.hpp
index 563af7d2..c111f80f 100644
--- a/Private/NewKit/Defines.hpp
+++ b/Private/NewKit/Defines.hpp
@@ -8,10 +8,6 @@
#include <NewKit/Macros.hpp>
-#ifndef __KERNEL__
-# error You are not compiling the kernel.
-#endif
-
#define NEWKIT_VERSION "1.01"
#if !defined(_INC_NO_STDC_HEADERS) && defined(__GNUC__)
@@ -20,9 +16,11 @@
#ifdef __has_feature
#if !__has_feature(cxx_nullptr)
+#if !__has_nullptr
#error You must at least have nullptr featured on your C++ compiler.
#endif
#endif
+#endif
namespace HCore {
using voidPtr = void *;
@@ -89,6 +87,28 @@ template <typename Args>
inline Args &&move(Args &&arg) {
return static_cast<Args &&>(arg);
}
+
+/// @brief Encoding class
+class Encoder final {
+public:
+ explicit Encoder() = default;
+ ~Encoder() = default;
+
+ Encoder &operator=(const Encoder &) = default;
+ Encoder(const Encoder &) = default;
+
+public:
+ template <typename T>
+ Char* AsBytes(T type) {
+ return reinterpret_cast<Char*>(type);
+ }
+
+ template <typename T, typename Y>
+ Y As(T type) {
+ return reinterpret_cast<Y>(type);
+ }
+
+};
} // namespace HCore
#define DEDUCE_ENDIAN(address, value) \