CPU/PGXP: Use bit math for flags instead of union

This commit is contained in:
Stenzek
2024-05-17 19:00:25 +10:00
parent 82f3e17b78
commit 29d4e04e3b
2 changed files with 71 additions and 50 deletions

View File

@ -56,12 +56,14 @@ struct PGXP_value
float y;
float z;
u32 value;
union
u32 flags;
ALWAYS_INLINE void SetValidComp(u32 comp, bool valid)
{
u32 flags;
u8 compFlags[4];
u16 halfFlags[2];
};
flags = (flags & ~(1u << comp)) | (static_cast<u32>(valid) << comp);
}
ALWAYS_INLINE bool GetValidComp(u32 comp) const { return ConvertToBoolUnchecked((flags >> comp) & 1); }
};
struct State