whoops turns out union cast is required to make it work

This commit is contained in:
HJfod 2023-01-23 19:51:51 +02:00
parent e65f1184e7
commit 9e52089a01

View file

@ -10,6 +10,7 @@
#include <cstdlib> #include <cstdlib>
#include <stddef.h> #include <stddef.h>
#include <type_traits> #include <type_traits>
#include "../utils/casts.hpp"
namespace geode::addresser { namespace geode::addresser {
@ -201,7 +202,7 @@ namespace geode::addresser {
// do NOT delete the line below. // do NOT delete the line below.
// doing so breaks thunk adjusting on windows. // doing so breaks thunk adjusting on windows.
// why? bruh idk // why? bruh idk
auto _ = *(ptrdiff_t*)(&func); auto _ = *geode::cast::template union_cast<ptrdiff_t*>(&func);
return (F)((intptr_t)self + Addresser::thunkOf(func)); return (F)((intptr_t)self + Addresser::thunkOf(func));
} }
@ -210,7 +211,7 @@ namespace geode::addresser {
// do NOT delete the line below. // do NOT delete the line below.
// doing so breaks thunk adjusting on windows. // doing so breaks thunk adjusting on windows.
// why? bruh idk // why? bruh idk
auto _ = *(ptrdiff_t*)(&func); auto _ = *geode::cast::template union_cast<ptrdiff_t*>(&func);
return (F)((intptr_t)self - Addresser::thunkOf(func)); return (F)((intptr_t)self - Addresser::thunkOf(func));
} }
#endif #endif