From 3770de7a03879a8ff6b8cf22b402217c19fa2b53 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Mon, 18 Dec 2023 21:41:57 -0500 Subject: Change colour_t to be a strongly typed structure Make RGB default of `colour_t` Distinguish RGB and ARGB colors by type and colour_traits Add `_colour` and `_argb` colour user-defined literals Add `OpenVic::utility::unreachable` --- src/openvic-simulation/utility/Utility.hpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/openvic-simulation/utility/Utility.hpp (limited to 'src/openvic-simulation/utility/Utility.hpp') diff --git a/src/openvic-simulation/utility/Utility.hpp b/src/openvic-simulation/utility/Utility.hpp new file mode 100644 index 0000000..e8d7205 --- /dev/null +++ b/src/openvic-simulation/utility/Utility.hpp @@ -0,0 +1,14 @@ +#pragma once + +namespace OpenVic::utility { + [[noreturn]] inline void unreachable() { + // Uses compiler specific extensions if possible. + // Even if no extension is used, undefined behavior is still raised by + // an empty function body and the noreturn attribute. +#ifdef __GNUC__ // GCC, Clang, ICC + __builtin_unreachable(); +#elif defined(_MSC_VER) // MSVC + __assume(false); +#endif + } +} -- cgit v1.2.3-56-ga3b1