core/place: Remove unnecessary sqrt in comparator functions
Remove unnecessary sqrt() calls in northwest_cmp and northeast_cmp. The square root would have been necessary if we needed the actual distance, but we only care about the relative order, so it isn't. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4202>
This commit is contained in:
parent
970ac8ff50
commit
14b90daa5a
@ -72,9 +72,8 @@ northwest_cmp (gconstpointer a,
|
|||||||
bx = b_frame.x;
|
bx = b_frame.x;
|
||||||
by = b_frame.y;
|
by = b_frame.y;
|
||||||
|
|
||||||
/* probably there's a fast good-enough-guess we could use here. */
|
from_origin_a = ax * ax + ay * ay;
|
||||||
from_origin_a = (int) sqrt (ax * ax + ay * ay);
|
from_origin_b = bx * bx + by * by;
|
||||||
from_origin_b = (int) sqrt (bx * bx + by * by);
|
|
||||||
|
|
||||||
if (from_origin_a < from_origin_b)
|
if (from_origin_a < from_origin_b)
|
||||||
return -1;
|
return -1;
|
||||||
@ -105,9 +104,8 @@ northeast_cmp (gconstpointer a,
|
|||||||
bx = (area->x + area->width) - (b_frame.x + b_frame.width);
|
bx = (area->x + area->width) - (b_frame.x + b_frame.width);
|
||||||
by = b_frame.y;
|
by = b_frame.y;
|
||||||
|
|
||||||
/* probably there's a fast good-enough-guess we could use here. */
|
from_origin_a = ax * ax + ay * ay;
|
||||||
from_origin_a = (int) sqrt (ax * ax + ay * ay);
|
from_origin_b = bx * bx + by * by;
|
||||||
from_origin_b = (int) sqrt (bx * bx + by * by);
|
|
||||||
|
|
||||||
if (from_origin_a < from_origin_b)
|
if (from_origin_a < from_origin_b)
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user