feat(gx): add equality operator to CGxStateBom

This commit is contained in:
fallenoak 2023-04-15 09:16:06 -05:00
parent 317d94cd1a
commit 36fa30eba8
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 34 additions and 6 deletions

View File

@ -33,20 +33,42 @@ const CGxStateBom& CGxStateBom::operator=(C3Vector& value) {
return *this;
}
bool CGxStateBom::operator!=(int32_t value) {
return this->m_data.i[0] != value;
bool CGxStateBom::operator==(float value) {
return this->m_data.f[0] == value;
}
bool CGxStateBom::operator!=(uint32_t value) {
return this->m_data.i[0] != value;
bool CGxStateBom::operator==(int32_t value) {
return this->m_data.i[0] == value;
}
bool CGxStateBom::operator==(uint32_t value) {
return this->m_data.u[0] == value;
}
bool CGxStateBom::operator==(void* value) {
return this->m_data.p == value;
}
bool CGxStateBom::operator==(C3Vector& value) {
return this->m_data.f[0] == value.x
|| this->m_data.f[1] == value.y
|| this->m_data.f[2] == value.z;
}
bool CGxStateBom::operator!=(float value) {
return this->m_data.f[0] != value;
return !(*this == value);
}
bool CGxStateBom::operator!=(int32_t value) {
return !(*this == value);
}
bool CGxStateBom::operator!=(uint32_t value) {
return !(*this == value);
}
bool CGxStateBom::operator!=(void* value) {
return this->m_data.p != value;
return !(*this == value);
}
bool CGxStateBom::operator!=(C3Vector& value) {

View File

@ -11,6 +11,7 @@ class CGxStateBom {
// Member variables
union {
int32_t i[3];
uint32_t u[3];
float f[3];
void* p;
} m_data;
@ -23,6 +24,11 @@ class CGxStateBom {
const CGxStateBom& operator=(uint32_t);
const CGxStateBom& operator=(void*);
const CGxStateBom& operator=(C3Vector&);
bool operator==(float);
bool operator==(int32_t);
bool operator==(uint32_t);
bool operator==(void*);
bool operator==(C3Vector&);
bool operator!=(float);
bool operator!=(int32_t);
bool operator!=(uint32_t);