change the alignment things

This commit is contained in:
altalk23 2024-06-20 20:06:00 +03:00
parent 7d79ddde30
commit 1a513ec3c6
2 changed files with 3 additions and 3 deletions
loader/include/Geode/modify

View file

@ -58,7 +58,7 @@ namespace geode::modifier {
using Intermediate = Modify<Parent, Base>;
// Padding used for guaranteeing any member of parents
// will be in between sizeof(Intermediate) and sizeof(Parent)
alignas(std::max(alignof(Base), alignof(uintptr_t))) uintptr_t m_padding;
std::aligned_storage_t<std::alignment_of_v<Base>, std::alignment_of_v<Base>> m_padding;
public:
// the constructor that constructs the fields.

View file

@ -100,8 +100,8 @@ namespace geode::modifier {
// unordered_map<handles> idea
ModifyBase() {
static constexpr bool hasImproperCustomFields =
sizeof(typename ModifyDerived::Derived) != sizeof(typename ModifyDerived::Base) + std::max(std::alignment_of_v<typename ModifyDerived::Base>, sizeof(uintptr_t));
static constexpr bool hasImproperCustomFields = sizeof(typename ModifyDerived::Derived) >= 1 &&
sizeof(typename ModifyDerived::Derived) != sizeof(typename ModifyDerived::Base) + std::alignment_of_v<typename ModifyDerived::Base>;
static_assert(!hasImproperCustomFields,
"\n--- Error in modify class:\n"
" Do not add members to a modify class, use `struct Fields` instead.\n"