Fix sizeof/offsetof assertions.

This commit is contained in:
Skyth
2024-11-25 18:29:15 +03:00
parent 49b0dbe4db
commit 349f07cf77
4 changed files with 5 additions and 18 deletions

View File

@@ -15,7 +15,6 @@
#include "CSD/Manager/csdmSceneObserver.h"
#include "CSD/Manager/csdmSubjectBase.h"
#include "CSD/Platform/csdTexList.h"
#include "Hedgehog/Base/Container/hhVector.h"
#include "Hedgehog/Base/System/hhAllocator.h"
#include "Hedgehog/Base/Thread/hhHolder.h"
#include "Hedgehog/Base/Thread/hhHolderBase.h"

View File

@@ -11,26 +11,12 @@
uint8_t SWA_CONCAT(pad, __LINE__)[length]
#define SWA_ASSERT_OFFSETOF(type, field, offset) \
static inline swa_assert_offsetof<BB_OFFSETOF(type, field), offset> SWA_CONCAT(_, __COUNTER__)
static_assert(offsetof(type, field) == offset)
#define SWA_ASSERT_SIZEOF(type, size) \
static inline swa_assert_sizeof<sizeof type, size> SWA_CONCAT(_, __COUNTER__)
static_assert(sizeof(type) == size)
#define SWA_VIRTUAL_FUNCTION(returnType, virtualIndex, ...) \
GuestToHostFunction<returnType>(*(be<uint32_t>*)(g_memory.Translate(*(be<uint32_t>*)(this) + (4 * virtualIndex))), __VA_ARGS__)
struct swa_null_ctor
{
};
template<int TActual, int TExpected>
struct swa_assert_offsetof
{
static_assert(TActual == TExpected, "offsetof assertion failed");
};
template<int TActual, int TExpected>
struct swa_assert_sizeof
{
static_assert(TActual == TExpected, "sizeof assertion failed");
};
struct swa_null_ctor {};