ams: remove TYPED_STORAGE() macro in favor of template

This commit is contained in:
Michael Scire
2021-03-21 18:47:30 -07:00
parent 8d9174b227
commit aff0da9427
31 changed files with 55 additions and 57 deletions

View File

@@ -63,7 +63,7 @@ namespace ams::util {
union Union {
char c;
UnionHolder first_union;
TYPED_STORAGE(ParentType) parent;
TypedStorage<ParentType> parent;
/* This coerces the active member to be c. */
constexpr Union() : c() { /* ... */ }
@@ -110,7 +110,7 @@ namespace ams::util {
template<typename ParentType, typename MemberType>
struct OffsetOfCalculator {
static constexpr std::ptrdiff_t OffsetOf(MemberType ParentType::*member) {
constexpr TYPED_STORAGE(ParentType) Holder = {};
constexpr TypedStorage<ParentType> Holder = {};
const auto *parent = GetPointer(Holder);
const auto *target = std::addressof(parent->*member);
return static_cast<const uint8_t *>(static_cast<const void *>(target)) - static_cast<const uint8_t *>(static_cast<const void *>(parent));