From fcc3c353fd250994dec73c4aa4bd66d976c910bb Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Wed, 3 Apr 2024 23:39:26 +0200 Subject: Separate gsl stuff, and use std-like int types --- deimos/core/std.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'deimos/core/std.h') 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 constexpr bool is_trivially_destructible_v = __is_trivially_destructible(T); + template constexpr bool _is_same_helper = false; template constexpr bool _is_same_helper = true; template concept same_as = _is_same_helper && _is_same_helper; @@ -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, ""); @@ -47,3 +66,8 @@ static_assert(std::same_as, int>, ""); static_assert(std::same_as, int>, ""); static_assert(std::same_as, int>, ""); +constexpr void* operator new(size_t, void* ptr) +{ + return ptr; +} + -- cgit