Skip to content

Commit cac2cbc

Browse files
committed
fix field alignment by doing max
1 parent f8c5e97 commit cac2cbc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

loader/include/Geode/modify/Field.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22

3+
#include "../utils/MiniFunction.hpp"
34
#include "Traits.hpp"
45

56
#include <Geode/loader/Loader.hpp>
6-
#include "../utils/MiniFunction.hpp"
77
#include <cocos2d.h>
88
#include <vector>
99

@@ -49,16 +49,15 @@ namespace geode::modifier {
4949
}
5050
};
5151

52-
[[deprecated("Will be removed in 1.0.0")]]
53-
GEODE_DLL size_t getFieldIndexForClass(size_t hash);
52+
[[deprecated("Will be removed in 1.0.0")]] GEODE_DLL size_t getFieldIndexForClass(size_t hash);
5453
GEODE_DLL size_t getFieldIndexForClass(char const* name);
5554

5655
template <class Parent, class Base>
5756
class FieldIntermediate {
5857
using Intermediate = Modify<Parent, Base>;
5958
// Padding used for guaranteeing any member of parents
6059
// will be in between sizeof(Intermediate) and sizeof(Parent)
61-
alignas(Base) uintptr_t m_padding;
60+
alignas(std::max(alignof(Base), alignof(uintptr_t))) uintptr_t m_padding;
6261

6362
public:
6463
// the constructor that constructs the fields.
@@ -120,7 +119,7 @@ namespace geode::modifier {
120119
reinterpret_cast<std::byte*>(offsetField) - sizeof(Intermediate)
121120
);
122121
}
123-
122+
124123
Parent* self() {
125124
return this->operator Parent*();
126125
}

0 commit comments

Comments
 (0)