Mercurial > minori
diff include/core/bit_cast.h @ 369:47c9f8502269
*: clang-format all the things
I've edited the formatting a bit. Now pointer asterisks (and reference
ampersands) are on the variable instead of the type, as well as having
newlines for function braces (but nothing else)
author | Paper <paper@tflc.us> |
---|---|
date | Fri, 25 Jul 2025 10:16:02 -0400 |
parents | 99c961c91809 |
children |
line wrap: on
line diff
--- a/include/core/bit_cast.h Fri Jul 25 10:05:23 2025 -0400 +++ b/include/core/bit_cast.h Fri Jul 25 10:16:02 2025 -0400 @@ -3,15 +3,16 @@ /* XXX need to move more "core" stuff into the minori namespace */ -#include <type_traits> +#include <cstring> #include <memory> -#include <cstring> +#include <type_traits> namespace minori { /* C++17 doesn't have this unfortunately */ template<typename To, class From> -To BitCast(From from) { +To BitCast(From from) +{ static_assert(sizeof(From) == sizeof(To), "Types must match sizes"); static_assert(std::is_pod<From>::value, "Requires POD input"); static_assert(std::is_pod<To>::value, "Requires POD output"); @@ -21,6 +22,6 @@ return to; } -} +} // namespace minori #endif /* MINORI_CORE_BIT_CAST_H_ */