diff options
Diffstat (limited to 'deimos/core/std.h')
-rw-r--r-- | deimos/core/std.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/deimos/core/std.h b/deimos/core/std.h index 1c611cd..601bfb9 100644 --- a/deimos/core/std.h +++ b/deimos/core/std.h @@ -1,8 +1,24 @@ #pragma once
+using uint8_t = unsigned char;
+using uint16_t = unsigned short;
+using uint32_t = unsigned int;
+using uint64_t = unsigned long long;
+
+using int8_t = char;
+using int16_t = short;
+using int32_t = int;
+using int64_t = long long;
+
+using size_t = uint64_t;
+
+static_assert(sizeof(size_t) == sizeof(void*), "size_t should be pointer size");
+
namespace std
{
+template<typename T> constexpr bool is_trivially_destructible_v = __is_trivially_destructible(T);
+
template<typename U, typename V> constexpr bool _is_same_helper = false;
template<typename T> constexpr bool _is_same_helper<T, T> = true;
template<typename U, typename V> concept same_as = _is_same_helper<U, V> && _is_same_helper<V, U>;
@@ -38,6 +54,9 @@ constexpr T exchange(T& obj, U&& new_value) return old_value;
}
+enum __attribute__((__may_alias__)) byte : uint8_t {};
+static_assert(sizeof(byte) == 1, "");
+
} // namespace std
static_assert(std::same_as<int, int>, "");
@@ -47,3 +66,8 @@ static_assert(std::same_as<std::remove_reference_t<int>, int>, ""); static_assert(std::same_as<std::remove_reference_t<int&>, int>, "");
static_assert(std::same_as<std::remove_reference_t<int&&>, int>, "");
+constexpr void* operator new(size_t, void* ptr)
+{
+ return ptr;
+}
+
|