From baf2afd8cd672dcb9c13d956dfdd73b61dfee558 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Tue, 19 Mar 2024 10:05:31 +0100 Subject: 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 --- Private/NewKit/Defines.hpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'Private/NewKit') 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 -#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 inline Args &&move(Args &&arg) { return static_cast(arg); } + +/// @brief Encoding class +class Encoder final { +public: + explicit Encoder() = default; + ~Encoder() = default; + + Encoder &operator=(const Encoder &) = default; + Encoder(const Encoder &) = default; + +public: + template + Char* AsBytes(T type) { + return reinterpret_cast(type); + } + + template + Y As(T type) { + return reinterpret_cast(type); + } + +}; } // namespace HCore #define DEDUCE_ENDIAN(address, value) \ -- cgit v1.2.3