[ox/preloader] Cleanup
This commit is contained in:
21
deps/ox/src/ox/preloader/platspecs.hpp
vendored
21
deps/ox/src/ox/preloader/platspecs.hpp
vendored
@@ -21,11 +21,12 @@ struct NativePlatSpec {
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]]
|
||||
static constexpr auto alignOf(const T &v) noexcept {
|
||||
static constexpr std::size_t alignOf(const T &v) noexcept {
|
||||
if constexpr(ox::is_integral_v<T>) {
|
||||
return alignof(T);
|
||||
} else if constexpr(ox::is_pointer_v<T>) {
|
||||
return PtrAlign;
|
||||
PtrType p = 0;
|
||||
return alignOf(p);
|
||||
} else {
|
||||
AlignmentCatcher<NativePlatSpec> c;
|
||||
oxAssert(model(c.interface(), &v), "Could not get alignment for type");
|
||||
@@ -41,11 +42,17 @@ struct NativePlatSpec {
|
||||
|
||||
template<typename PlatSpec, typename T>
|
||||
[[nodiscard]]
|
||||
constexpr std::size_t alignOf(const T &t) noexcept {
|
||||
return PlatSpec::alignOf(t);
|
||||
constexpr std::size_t alignOf(const T &v) noexcept {
|
||||
if constexpr(ox::is_integral_v<T>) {
|
||||
return alignof(T);
|
||||
} else if constexpr(ox::is_pointer_v<T>) {
|
||||
typename PlatSpec::PtrType p = 0;
|
||||
return PlatSpec::alignOf(p);
|
||||
} else {
|
||||
AlignmentCatcher<NativePlatSpec> c;
|
||||
oxAssert(model(c.interface(), &v), "Could not get alignment for type");
|
||||
return c.biggestAlignment;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename PlatSpec, typename T>
|
||||
constexpr auto alignOf_v = alignOf<PlatSpec>(static_cast<T*>(nullptr));
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user