From 75902ba2a30adc0607278dc6725d9b101480a354 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 24 Apr 2021 15:43:11 -0500 Subject: [PATCH] [ox/std] Add cbit_cast as a stop-gap until I can implment a normal constexpr bit_cast --- deps/ox/src/ox/std/bit.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deps/ox/src/ox/std/bit.hpp b/deps/ox/src/ox/std/bit.hpp index d7d5b1c5..fd6b61b6 100644 --- a/deps/ox/src/ox/std/bit.hpp +++ b/deps/ox/src/ox/std/bit.hpp @@ -14,6 +14,13 @@ namespace ox { +template +constexpr typename enable_if::type cbit_cast(From src) noexcept { + To dst; + ox_memcpy(&dst, &src, sizeof(src)); + return dst; +} + template typename enable_if::type bit_cast(From src) noexcept { To dst;