[ox] Add Vector/Array/Span overflow checking

This commit is contained in:
2024-11-14 21:08:38 -06:00
parent 13bfe88195
commit f772e48b36
10 changed files with 112 additions and 50 deletions

View File

@ -24,6 +24,7 @@ class exception {
}
#endif
#include "defines.hpp"
#include "def.hpp"
#include "typetraits.hpp"
#include "utility.hpp"
@ -332,4 +333,12 @@ constexpr Error toError(const Result<T> &r) noexcept {
}
constexpr void primitiveAssert(const char *file, int line, bool pass, const char *msg) noexcept {
if constexpr(ox::defines::Debug) {
if (!pass) [[unlikely]] {
panic(file, line, msg, OxError(1));
}
}
}
}