summaryrefslogtreecommitdiffhomepage
path: root/dev/LibC++
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-22 09:59:41 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-22 09:59:41 +0100
commitb5adf16a96b9cbb80c74cf30404ed5bcff03ac34 (patch)
treee1be4c79f2c7e878d162c23d5c0518c350b00724 /dev/LibC++
parentb8e6e1492ed14e270b1061809b0569b8d2f4c0ec (diff)
chore: DebuggerKit cleanup.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/LibC++')
-rw-r--r--dev/LibC++/__abi.h8
-rw-r--r--dev/LibC++/base_math.h17
-rw-r--r--dev/LibC++/base_process.h16
-rw-r--r--dev/LibC++/defines.h10
4 files changed, 35 insertions, 16 deletions
diff --git a/dev/LibC++/__abi.h b/dev/LibC++/__abi.h
index d46a9ee..70afae5 100644
--- a/dev/LibC++/__abi.h
+++ b/dev/LibC++/__abi.h
@@ -6,4 +6,10 @@
#pragma once
-extern "C" void __compilerkit_unreachable(void);
+#include <LibC++/defines.h>
+
+__init_decl()
+
+extern void __compilerkit_unreachable(void);
+
+__fini_decl() \ No newline at end of file
diff --git a/dev/LibC++/base_math.h b/dev/LibC++/base_math.h
index 73cb174..60b260e 100644
--- a/dev/LibC++/base_math.h
+++ b/dev/LibC++/base_math.h
@@ -8,10 +8,14 @@
#include <LibC++/defines.h>
+#ifndef NAN
+#define NAN (__builtin_nanf(""))
+#endif // !NAN
+
/// @file Math.h
/// @brief Math functions.
-#ifdef __NE_USE_DOUBLE__
+#ifdef __LIBCXX_USE_DOUBLE__
typedef double real_type;
#else
typedef float real_type;
@@ -20,7 +24,9 @@ typedef float real_type;
namespace std::base_math {
inline constexpr static auto not_a_number = NAN;
+/// =========================================================== ///
/// @brief Power function, with Repeat argument.
+/// =========================================================== ///
template <size_t Exponent>
inline real_type pow(real_type in) {
if (Exponent == 0) return 1; // Any number to the power of 0 is 1.
@@ -36,6 +42,9 @@ inline real_type pow(real_type in) {
return result;
}
+/// =========================================================== ///
+/// @brief Square root function.
+/// =========================================================== ///
inline real_type sqrt(real_type in) {
if (in == 0) return 0;
if (in == not_a_number) return not_a_number;
@@ -51,8 +60,10 @@ inline real_type sqrt(real_type in) {
return x;
}
+/// =========================================================== ///
/// @brief Square of function, with Base template argument.
-/// @param of Base argument to find sqquare of
+/// @param of Base argument to find the square of.
+/// =========================================================== ///
template <size_t Base>
inline real_type surd(real_type in) {
if (in == 0) return 0;
@@ -64,10 +75,12 @@ inline real_type surd(real_type in) {
return not_a_number;
}
+/// =========================================================== ///
/// @brief Linear interpolation equation solver.
/// @param from where?
/// @param to to?
/// @param Updated diff value according to difference.
+/// =========================================================== ///
inline real_type lerp(real_type to, real_type from, real_type stat) {
real_type diff = (to - from);
return from + (diff * stat);
diff --git a/dev/LibC++/base_process.h b/dev/LibC++/base_process.h
index abcbf08..f9b0596 100644
--- a/dev/LibC++/base_process.h
+++ b/dev/LibC++/base_process.h
@@ -8,14 +8,22 @@
#include <LibC++/defines.h>
+__init_decl()
+
/// @brief CRT exit, with exit code (!!! exits all threads. !!!)
/// @param code the exit code.
/// @return the return > 0 for non successful.
-extern "C" int exit_(int code);
+extern int exit_(int code);
/// @brief CRT signal handler.
/// @param code the signal code.
-extern "C" void signal_(int code);
+extern void signal_(int code);
+
+extern void (*__atexit_cdecl_ptr)(void);
+extern void (**__atexit_lst_ptr)(void);
+extern size_t __atexit_lst_cnt;
+
+__fini_decl()
/// @brief Standard C++ namespace
namespace std::base_process {
@@ -24,10 +32,6 @@ inline int signal(int code) {
return -1;
}
-extern "C" void (*__atexit_cdecl_ptr)(void);
-extern "C" void (**__atexit_lst_ptr)(void);
-extern "C" size_t __atexit_lst_cnt;
-
inline int32_t exit(const int32_t& code) {
for (auto idx = 0UL; idx < __atexit_lst_cnt; ++idx) {
__atexit_lst_ptr[idx]();
diff --git a/dev/LibC++/defines.h b/dev/LibC++/defines.h
index e263d9c..b8ef10c 100644
--- a/dev/LibC++/defines.h
+++ b/dev/LibC++/defines.h
@@ -7,20 +7,16 @@
#ifndef __NECTI_DEFINES_H__
#define __NECTI_DEFINES_H__
-extern "C" {
-#include <stddef.h>
-#include <stdint.h>
-}
-
#define __ATTRIBUTE(X) __attribute__((X))
typedef __SIZE_TYPE__ size_t;
-typedef __SSIZE_TYPE__ ssize_t;
+typedef __INT64_TYPE__ ssize_t;
+typedef __INT32_TYPE__ int32_t;
typedef void* ptr_type;
typedef __SIZE_TYPE__ size_type;
-typedef size_t ptrdiff_t;
+typedef __INT64_TYPE__ ptrdiff_t;
typedef size_t uintptr_t;
typedef void* voidptr_t;
typedef void* any_t;