mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 16:31:28 +12:00
Added .aligned() method for vm::ptr
Added set_alignment() macro for setting alignment Added alignof32() macro similar to sizeof32() Added CHECK_SIZE, CHECK_ALIGN macro with static_assert Minor refactoring
This commit is contained in:
parent
a7f77c27f7
commit
e896da8064
18 changed files with 1202 additions and 1237 deletions
|
@ -64,20 +64,25 @@ template<typename T, typename = std::enable_if_t<std::is_integral<T>::value>> in
|
|||
// return 32 bit sizeof() to avoid widening/narrowing conversions with size_t
|
||||
#define sizeof32(type) sizeof32_t<sizeof(type)>::value
|
||||
|
||||
// return 32 bit alignof() to avoid widening/narrowing conversions with size_t
|
||||
#define alignof32(type) alignof32_t<__alignof(type)>::value
|
||||
|
||||
template<std::size_t Size> struct sizeof32_t
|
||||
{
|
||||
static_assert(Size <= UINT32_MAX, "sizeof32() error: sizeof() is too big");
|
||||
static_assert(Size <= UINT32_MAX, "sizeof32() error: size is too big");
|
||||
|
||||
static const u32 value = static_cast<u32>(Size);
|
||||
};
|
||||
|
||||
template<std::size_t Align> struct alignof32_t
|
||||
{
|
||||
static_assert(Align <= UINT32_MAX, "alignof32() error: alignment is too big");
|
||||
|
||||
static const u32 value = static_cast<u32>(Align);
|
||||
};
|
||||
|
||||
template<typename T> using func_def = T; // workaround for MSVC bug: `using X = func_def<void()>;` instead of `using X = void();`
|
||||
|
||||
#include "Utilities/BEType.h"
|
||||
#include "Utilities/StrFmt.h"
|
||||
|
||||
#include "Emu/Memory/atomic.h"
|
||||
|
||||
template<typename T> struct ID_type;
|
||||
|
||||
#define REG_ID_TYPE(t, id) template<> struct ID_type<t> { static const u32 type = id; }
|
||||
|
@ -89,3 +94,7 @@ template<typename T> struct ID_type;
|
|||
|
||||
#define _PRGNAME_ "RPCS3"
|
||||
#define _PRGVER_ "0.0.0.5"
|
||||
|
||||
#include "Utilities/BEType.h"
|
||||
#include "Utilities/StrFmt.h"
|
||||
#include "Emu/Memory/atomic.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue