// miscellaneous "language extensions" #pragma once #include // gcc only, no clang to complain here pls #if defined(__GNUC__) && !defined(__clang__) #define force_opt __attribute__((optimize("3"))) #endif // things that work for gcc and clang #if defined(__GNUC__) || defined(__clang__) #define force_inline [[gnu::always_inline]] #endif // and empty defs for these if not available for current compiler #ifndef force_inline #define force_inline #endif #ifndef force_opt #define force_opt #endif template inline constexpr TO hard_cast(FROM f) { static_assert(std::is_pointer_v && std::is_pointer_v); return reinterpret_cast( reinterpret_cast(f) ); }