Add template for packed ints and fix missing define.

This commit is contained in:
Roz K 2023-01-06 17:02:24 +01:00
parent a6ec35ebd1
commit 9181d58ecd
Signed by: roz
GPG Key ID: 51FBF4E483E1C822

View File

@ -43,6 +43,28 @@ typedef unsigned __int128 rk_ullong;
typedef float rk_float;
typedef void * rk_handle_t;
#define RK_INVALID_HANDLE nullptr
static_assert(sizeof(rk_char) == 1);
static_assert(sizeof(rk_wchar) == 4);
static_assert(sizeof(rk_float) == 4);
#pragma pack(push, 4)
template<bool _signed, unsigned _cols>
struct rk_packed {
};
template<unsigned _cols>
struct alignas(alignof(rk_int)) rk_packed<true, _cols> {
typedef rk_int type;
rk_int packed;
};
template<unsigned _cols>
struct alignas(alignof(rk_uint)) rk_packed<false, _cols> {
typedef rk_uint type;
rk_uint packed;
};
#pragma pack(pop)
#endif // _RK_ENGINE_TYPES_H