diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-15 06:24:19 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-15 06:24:19 +0100 |
| commit | b0410ff37c15380e4409711bb14cc3880a9dc536 (patch) | |
| tree | 01876afb97dffe67913e16611564f360fc0ebfdb /src/kernel/NeKit | |
| parent | 62af164abe47951b8291b4162af08c69b5f2af21 (diff) | |
feat: kernel: bitmapmgr and heapmgr improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/NeKit')
| -rw-r--r-- | src/kernel/NeKit/Config.h | 6 | ||||
| -rw-r--r-- | src/kernel/NeKit/KString.h | 16 | ||||
| -rw-r--r-- | src/kernel/NeKit/Macros.h | 4 | ||||
| -rw-r--r-- | src/kernel/NeKit/Utils.h | 6 | ||||
| -rw-r--r-- | src/kernel/NeKit/Variant.h | 2 | ||||
| -rw-r--r-- | src/kernel/NeKit/Vettable.h | 4 |
6 files changed, 24 insertions, 14 deletions
diff --git a/src/kernel/NeKit/Config.h b/src/kernel/NeKit/Config.h index 1539a8fb..3e37fe2d 100644 --- a/src/kernel/NeKit/Config.h +++ b/src/kernel/NeKit/Config.h @@ -16,7 +16,7 @@ #define NE_ICODEC \ final: \ - public \ + public \ ::Kernel::ICodec /// @brief The **Kernel** namespace. @@ -111,12 +111,12 @@ inline Args&& move(Args&& arg) { template <class Type> concept IsSerializable = requires() { - { Type::kValue }; + {Type::kValue}; }; template <class Type> concept IsNotSerializable = requires() { - { !Type::kValue }; + {!Type::kValue}; }; /// @brief Encoding interface, used as a proxy to convert T to Char* diff --git a/src/kernel/NeKit/KString.h b/src/kernel/NeKit/KString.h index 99742239..c08113b9 100644 --- a/src/kernel/NeKit/KString.h +++ b/src/kernel/NeKit/KString.h @@ -27,13 +27,21 @@ class KBasicString final { rt_set_memory(fData, 0, fDataSz); } - KBasicString(SizeT Sz) : fDataSz(Sz) { - MUST_PASS(Sz > 1); + KBasicString(const CharKind* In) : fDataSz(oe_string_len(In)) { + fData = new CharKind[fDataSz]; + MUST_PASS(fData); + + rt_set_memory(fData, 0, fDataSz); + this->operator+=(In); + } + + KBasicString(const SizeT Sz) : fDataSz(Sz) { + MUST_PASS(fDataSz > 1); - fData = new CharKind[Sz]; + fData = new CharKind[fDataSz]; MUST_PASS(fData); - rt_set_memory(fData, 0, Sz); + rt_set_memory(fData, 0, fDataSz); } ~KBasicString() { diff --git a/src/kernel/NeKit/Macros.h b/src/kernel/NeKit/Macros.h index c0fc57f4..3a6e26fa 100644 --- a/src/kernel/NeKit/Macros.h +++ b/src/kernel/NeKit/Macros.h @@ -15,7 +15,7 @@ #endif #ifndef kib_cast -#define kib_cast(X) (Kernel::UInt64)((X) * 1024) +#define kib_cast(X) (Kernel::UInt64)((X) *1024) #endif #ifndef MIB @@ -116,7 +116,7 @@ #define NE_UNUSED(X) ((Kernel::Void) X) #ifndef RGB -#define RGB(R, G, B) ((Kernel::UInt32) ((0xFF << 24) | ((R) << 16) | ((G) << 8) | (B))) +#define RGB(R, G, B) ((Kernel::UInt32)((0xFF << 24) | ((R) << 16) | ((G) << 8) | (B))) #endif // !RGB #ifdef __NE_AMD64__ diff --git a/src/kernel/NeKit/Utils.h b/src/kernel/NeKit/Utils.h index e28e23eb..8ee1371b 100644 --- a/src/kernel/NeKit/Utils.h +++ b/src/kernel/NeKit/Utils.h @@ -54,9 +54,9 @@ inline constexpr SizeT oe_string_len(const CharType* str) { if (!str) return 0; #if __cplusplus == 202302L - if consteval { - return ARRAY_SIZE(str); - } else { + if + consteval { return ARRAY_SIZE(str); } + else { SizeT len{0}; while (str[len] != 0) ++len; return len; diff --git a/src/kernel/NeKit/Variant.h b/src/kernel/NeKit/Variant.h index 2f4ce1ff..d5086fc1 100644 --- a/src/kernel/NeKit/Variant.h +++ b/src/kernel/NeKit/Variant.h @@ -45,7 +45,7 @@ class Variant final { explicit Variant(VoidPtr ptr) : fPtr(ptr), fKind(VariantKind::kBlob) {} public: - const Char* ToString(); + KString ToString(); /// ======================================================================== /// @brief Returns the underlying pointer. diff --git a/src/kernel/NeKit/Vettable.h b/src/kernel/NeKit/Vettable.h index e3b8bf70..f2056d27 100644 --- a/src/kernel/NeKit/Vettable.h +++ b/src/kernel/NeKit/Vettable.h @@ -13,7 +13,9 @@ namespace Kernel { template <class Type> -concept IsVettable = requires(Type) { (Type::kVettable); }; +concept IsVettable = requires(Type) { + (Type::kVettable); +}; } // namespace Kernel #endif // !__NE_KIT_VETTABLE_H__ |
