Fix a bugprone-suspicious-memory-comparison warning

Bug: 252789852
Change-Id: I2afa8907e260e547f82e3fdf4127799221c05aa5
Test: existing tests
This commit is contained in:
Ady Abraham
2022-10-10 18:44:47 +00:00
parent d71dd97d97
commit a58d441dae

View File

@@ -71,9 +71,14 @@ public:
, right(rect.fRight)
, bottom(rect.fBottom) {}
friend int operator==(const Rect& a, const Rect& b) { return !memcmp(&a, &b, sizeof(a)); }
friend int operator==(const Rect& a, const Rect& b) {
return a.left == b.left &&
a.top == b.top &&
a.right == b.right &&
a.bottom == b.bottom;
}
friend int operator!=(const Rect& a, const Rect& b) { return memcmp(&a, &b, sizeof(a)); }
friend int operator!=(const Rect& a, const Rect& b) { return !(a == b); }
inline void clear() { left = top = right = bottom = 0.0f; }