WIP
This commit is contained in:
@@ -42,14 +42,18 @@ template <size_t Size> struct FieldBinder {
|
||||
template <typename T> T *operator=(T *src) {
|
||||
union V {
|
||||
T *a;
|
||||
void* b;
|
||||
void *b;
|
||||
};
|
||||
V* trick = reinterpret_cast<V*>(this);
|
||||
V *trick = reinterpret_cast<V *>(this);
|
||||
return trick->a = src;
|
||||
}
|
||||
ExpectedType& operator=(ExpectedType src) {
|
||||
ExpectedType &operator=(ExpectedType src) {
|
||||
return *reinterpret_cast<ExpectedType *>(dst) = src;
|
||||
}
|
||||
ExpectedType &operator=(FieldBinder<Size> &other) {
|
||||
return *reinterpret_cast<ExpectedType *>(dst) =
|
||||
*reinterpret_cast<ExpectedType *>(other.dst);
|
||||
}
|
||||
};
|
||||
|
||||
template <size_t Offset, size_t Size>
|
||||
@@ -83,18 +87,15 @@ inline constexpr cc_type_t CONCAT23(T0 a, T1 b) {
|
||||
return cc_type_t(a) << 24 | cc_type_t(b);
|
||||
}
|
||||
|
||||
template <typename T0>
|
||||
inline constexpr char SUB21(T0 a, size_t b) {
|
||||
template <typename T0> inline constexpr char SUB21(T0 a, size_t b) {
|
||||
return cc_type_t(a) >> (b * 8);
|
||||
}
|
||||
|
||||
template <typename T0>
|
||||
inline constexpr char SUB41(T0 a, size_t b) {
|
||||
template <typename T0> inline constexpr char SUB41(T0 a, size_t b) {
|
||||
return cc_type_t(a) >> (b * 8);
|
||||
}
|
||||
|
||||
template <typename T0>
|
||||
inline constexpr uint16_t SUB42(T0 a, size_t b) {
|
||||
template <typename T0> inline constexpr uint16_t SUB42(T0 a, size_t b) {
|
||||
return cc_type_t(a) >> (b * 8);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user