WIP Fixes

This commit is contained in:
Guus Waals 2024-09-24 04:51:46 +08:00
parent faa171b56b
commit 9084c7d3ac
2 changed files with 9 additions and 4 deletions

View File

@ -37,7 +37,12 @@ template <size_t Size> struct FieldBinder {
} }
template <typename T> T *operator=(T *src) { template <typename T> T *operator=(T *src) {
return reinterpret_cast<T *>(dst) = src; union V {
T *a;
void* b;
};
V* trick = reinterpret_cast<V*>(this);
return trick->a = src;
} }
ExpectedType& operator=(ExpectedType src) { ExpectedType& operator=(ExpectedType src) {
return *reinterpret_cast<ExpectedType *>(dst) = src; return *reinterpret_cast<ExpectedType *>(dst) = src;
@ -47,7 +52,7 @@ template <size_t Size> struct FieldBinder {
template <size_t Offset, size_t Size> template <size_t Offset, size_t Size>
inline FieldBinder<Size> operator+(const void *str, inline FieldBinder<Size> operator+(const void *str,
Field<Offset, Size> offset) { Field<Offset, Size> offset) {
return FieldBinder<Size>{.dst = (uint8_t *)str + offset}; return FieldBinder<Size>{.dst = (uint8_t *)str + Offset};
} }
#endif /* B8D59B54_1674_4C0F_AA2C_611385FF5D03 */ #endif /* B8D59B54_1674_4C0F_AA2C_611385FF5D03 */

View File

@ -43,8 +43,8 @@ typedef uint32_t cc_type_t;
template <typename T0, typename T1> template <typename T0, typename T1>
inline constexpr cc_type_t CONCAT12(T0 a, T1 b) { inline constexpr undefined3 CONCAT12(T0 a, T1 b) {
return cc_type_t(a) << 16 | cc_type_t(b); return undefined3(cc_type_t(a) << 16 | cc_type_t(b));
} }
template <typename T0, typename T1> template <typename T0, typename T1>
inline constexpr cc_type_t CONCAT11(T0 a, T1 b) { inline constexpr cc_type_t CONCAT11(T0 a, T1 b) {