From e020805cb140ed98d09e606a867b910fce78ad15 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Thu, 10 Oct 2024 23:38:35 +0200 Subject: Integers formatting --- asl/utility.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'asl/utility.hpp') diff --git a/asl/utility.hpp b/asl/utility.hpp index 2cbf8db..2d9ef05 100644 --- a/asl/utility.hpp +++ b/asl/utility.hpp @@ -1,6 +1,7 @@ #pragma once #include "asl/meta.hpp" +#include "asl/layout.hpp" #define ASL_MOVE(expr_) (static_cast<::asl::un_ref_t&&>(expr_)) @@ -17,6 +18,12 @@ T exchange(T& obj, U&& new_value) return old_value; } +template +constexpr U bit_cast(T value) requires (size_of == size_of) +{ + return __builtin_bit_cast(U, value); +} + #define ASL_DELETE_COPY(T) \ T(const T&) = delete; \ T& operator=(const T&) = delete; -- cgit