ams: improve offsetof style consistency
This commit is contained in:
@@ -50,7 +50,7 @@ namespace ams::crypto::impl {
|
||||
public:
|
||||
HmacImpl() : m_state(State_None) { /* ... */ }
|
||||
~HmacImpl() {
|
||||
static_assert(offsetof(HmacImpl, m_hash_function) == 0);
|
||||
static_assert(AMS_OFFSETOF(HmacImpl, m_hash_function) == 0);
|
||||
|
||||
/* Clear everything except for the hash function. */
|
||||
ClearMemory(reinterpret_cast<u8 *>(this) + sizeof(m_hash_function), sizeof(*this) - sizeof(m_hash_function));
|
||||
|
||||
@@ -563,7 +563,7 @@ namespace ams::svc {
|
||||
u64 padding[6];
|
||||
};
|
||||
static_assert(sizeof(ProcessLocalRegion) == 0x200);
|
||||
static_assert(OFFSETOF(ProcessLocalRegion, dying_message_region_address) == 0x1C0);
|
||||
static_assert(AMS_OFFSETOF(ProcessLocalRegion, dying_message_region_address) == 0x1C0);
|
||||
|
||||
}
|
||||
|
||||
@@ -607,7 +607,7 @@ namespace ams::svc {
|
||||
u64 padding[6];
|
||||
};
|
||||
static_assert(sizeof(ProcessLocalRegion) == 0x200);
|
||||
static_assert(OFFSETOF(ProcessLocalRegion, dying_message_region_address) == 0x1C0);
|
||||
static_assert(AMS_OFFSETOF(ProcessLocalRegion, dying_message_region_address) == 0x1C0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -170,11 +170,8 @@ namespace ams::util {
|
||||
|
||||
|
||||
/* Defines, for use by other code. */
|
||||
|
||||
#define OFFSETOF(parent, member) (::ams::util::impl::OffsetOf<&parent::member, parent>::value)
|
||||
|
||||
#define GET_PARENT_PTR(parent, member, _arg) (::ams::util::GetParentPointer<&parent::member, parent>(_arg))
|
||||
|
||||
#define GET_PARENT_REF(parent, member, _arg) (::ams::util::GetParentReference<&parent::member, parent>(_arg))
|
||||
#define AMS_OFFSETOF(parent, member) (__builtin_offsetof(parent, member))
|
||||
#define AMS_GET_PARENT_PTR(parent, member, _arg) (::ams::util::GetParentPointer<&parent::member, parent>(_arg))
|
||||
#define AMS_GET_PARENT_REF(parent, member, _arg) (::ams::util::GetParentReference<&parent::member, parent>(_arg))
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user