From 8970c40ce9a9a4e5f582b48f69b77bd90d8e678e Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Thu, 4 Apr 2024 23:29:08 +0200 Subject: Add DLL API --- deimos/core/std.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'deimos/core/std.h') diff --git a/deimos/core/std.h b/deimos/core/std.h index 89d7da5..42bedbe 100644 --- a/deimos/core/std.h +++ b/deimos/core/std.h @@ -22,6 +22,7 @@ template concept signed_integral = integral && __is_signed(T); template concept unsigned_integral = integral && __is_unsigned(T); template constexpr bool is_trivially_destructible_v = __is_trivially_destructible(T); +template constexpr bool is_trivially_copyable_v = __is_trivially_copyable(T); template constexpr bool _is_same_helper = false; template constexpr bool _is_same_helper = true; @@ -78,6 +79,13 @@ constexpr T exchange(T& obj, U&& new_value) enum __attribute__((__may_alias__)) byte : uint8_t {}; static_assert(sizeof(byte) == 1, ""); +template +requires (sizeof(To) == sizeof(From)) && is_trivially_copyable_v && is_trivially_copyable_v +constexpr To bit_cast(const From& from) noexcept +{ + return __builtin_bit_cast(To, from); +} + template class initializer_list { -- cgit