#pragma once #include #include using s8 = int8_t; using u8 = uint8_t; using s16 = int16_t; using u16 = uint16_t; using s32 = int32_t; using u32 = uint32_t; using s64 = int64_t; using u64 = uint64_t; #ifndef ROUND_UP_256 #define ROUND_UP_256(val) (((val) + 255) & ~255) #endif #ifndef ROUND_UP_64 #define ROUND_UP_64(val) (((val) + 63) & ~63) #endif #ifndef ROUND_UP_32 #define ROUND_UP_32(val) (((val) + 31) & ~31) #endif #ifndef ROUND_UP_16 #define ROUND_UP_16(val) (((val) + 15) & ~15) #endif #ifndef ROUND_UP_8 #define ROUND_UP_8(val) (((val) + 7) & ~7) #endif #ifndef ROUND_UP_4 #define ROUND_UP_4(val) (((val) + 3) & ~3) #endif #ifndef ENABLE_BITWISE_ENUM #define ENABLE_BITWISE_ENUM(type) \ constexpr type operator|(type a, type b) noexcept { \ using T = std::underlying_type_t; \ return type(static_cast(a) | static_cast(b)); \ } \ constexpr type operator&(type a, type b) noexcept { \ using T = std::underlying_type_t; \ return type(static_cast(a) & static_cast(b)); \ } \ constexpr type& operator|=(type& a, type b) noexcept { \ using T = std::underlying_type_t; \ a = type(static_cast(a) | static_cast(b)); \ return a; \ } \ constexpr type& operator&=(type& a, type b) noexcept { \ using T = std::underlying_type_t; \ a = type(static_cast(a) & static_cast(b)); \ return a; \ } \ constexpr type operator~(type key) noexcept { \ using T = std::underlying_type_t; \ return type(~static_cast(key)); \ } \ constexpr bool True(type key) noexcept { \ using T = std::underlying_type_t; \ return static_cast(key) != 0; \ } \ constexpr bool False(type key) noexcept { \ using T = std::underlying_type_t; \ return static_cast(key) == 0; \ } #endif