diff options
| -rw-r--r-- | .github/workflows/c-cpp-dev.yml | 19 | ||||
| -rw-r--r-- | .github/workflows/c-cpp.yml | 6 | ||||
| -rw-r--r-- | dev/DebuggerKit/DebuggerContract.h | 2 | ||||
| -rw-r--r-- | dev/DebuggerKit/NeKernelContract.h | 12 | ||||
| -rw-r--r-- | dev/LibC++/base_math.h | 25 |
5 files changed, 54 insertions, 10 deletions
diff --git a/.github/workflows/c-cpp-dev.yml b/.github/workflows/c-cpp-dev.yml new file mode 100644 index 0000000..0dad725 --- /dev/null +++ b/.github/workflows/c-cpp-dev.yml @@ -0,0 +1,19 @@ +name: C/C++ CI (CompilerKit) + +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Install Packages + run: sudo apt update && sudo apt install build-essential + + diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index c277991..9e7f7a1 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -1,4 +1,4 @@ -name: C/C++ CI +name: C/C++ CI (CompilerKit) on: push: @@ -14,4 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install Packages - run: sudo apt update && sudo apt install build-essential
\ No newline at end of file + run: sudo apt update && sudo apt install build-essential + + diff --git a/dev/DebuggerKit/DebuggerContract.h b/dev/DebuggerKit/DebuggerContract.h index 48c3603..9ee17d1 100644 --- a/dev/DebuggerKit/DebuggerContract.h +++ b/dev/DebuggerKit/DebuggerContract.h @@ -8,6 +8,8 @@ #include <string> #include <unordered_map> +#define DK_DEBUGGER_CONTRACT : public ::DebuggerKit::DebuggerContract + namespace DebuggerKit { class DebuggerContract; diff --git a/dev/DebuggerKit/NeKernelContract.h b/dev/DebuggerKit/NeKernelContract.h index d5315ef..ddea826 100644 --- a/dev/DebuggerKit/NeKernelContract.h +++ b/dev/DebuggerKit/NeKernelContract.h @@ -21,10 +21,11 @@ namespace Detail { inline constexpr auto kDebugPort = 51820; inline constexpr auto kDebugMagic = "VMK1.0.0;"; inline constexpr auto kDebugVersion = 0x0100; - typedef char rt_debug_cmd[kDebugCmdLen]; + typedef char dk_debug_cmd_type[kDebugCmdLen]; + typedef int64_t dk_socket_type; } // namespace Detail -class NeKernelContract : public DebuggerContract { +class NeKernelContract DK_DEBUGGER_CONTRACT { public: NeKernelContract(); virtual ~NeKernelContract() override; @@ -33,8 +34,6 @@ class NeKernelContract : public DebuggerContract { NeKernelContract& operator=(const NeKernelContract&) = default; NeKernelContract(const NeKernelContract&) = default; - // Override additional methods from DebuggerContract - public: bool Attach(std::string path, std::string arg_v, ProcessID& pid) noexcept override; bool BreakAt(std::string symbol) noexcept override; @@ -43,8 +42,9 @@ class NeKernelContract : public DebuggerContract { bool Detach() noexcept override; private: - std::string m_kernel_path{}; - int64_t m_socket{0}; + dk_debug_cmd_type m_buffer; + std::string m_kernel_path{}; + dk_socket_type m_socket{0}; }; } // namespace DebuggerKit::NeKernel diff --git a/dev/LibC++/base_math.h b/dev/LibC++/base_math.h index ca6aace..7c9f34d 100644 --- a/dev/LibC++/base_math.h +++ b/dev/LibC++/base_math.h @@ -18,6 +18,8 @@ typedef float real_type; #endif 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) { @@ -34,13 +36,32 @@ inline real_type pow(real_type in) { return result; } +inline real_type sqrt(real_type in) { + if (in == 0) return 0; + if (in == not_a_number) return not_a_number; + + auto constexpr const static Base = 2; + + auto x = in / Base; + + for (int i = 0; i < 10; ++i) { + x = (x + in / x) / Base; + } + + return x; +} + /// @brief Square of function, with Base template argument. /// @param of Base argument to find sqquare of template <size_t Base> -inline real_type sqr(real_type in) { +inline real_type surd(real_type in) { if (in == 0) return 0; + if (in == 1) return 1; + + if (Base == 1) return in; + if (Base == 2) return sqrt(in); - return pow<1 / Base>(in); + return not_a_number; } /// @brief Linear interpolation equation solver. |
