Avoid unintended float -> double conversion in SDL_FRectEqualsEpsilon

Resolves: https://github.com/libsdl-org/SDL/issues/5691
Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2022-05-19 19:45:24 +01:00 committed by Sam Lantinga
parent f0566702c5
commit b0a27cb1de
1 changed files with 4 additions and 4 deletions

View File

@ -252,10 +252,10 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEmpty(const SDL_FRect *r)
SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon) SDL_FORCE_INLINE SDL_bool SDL_FRectEqualsEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon)
{ {
return (a && b && ((a == b) || return (a && b && ((a == b) ||
((SDL_fabs(a->x - b->x) <= epsilon) && ((SDL_fabsf(a->x - b->x) <= epsilon) &&
(SDL_fabs(a->y - b->y) <= epsilon) && (SDL_fabsf(a->y - b->y) <= epsilon) &&
(SDL_fabs(a->w - b->w) <= epsilon) && (SDL_fabsf(a->w - b->w) <= epsilon) &&
(SDL_fabs(a->h - b->h) <= epsilon)))) (SDL_fabsf(a->h - b->h) <= epsilon))))
? SDL_TRUE : SDL_FALSE; ? SDL_TRUE : SDL_FALSE;
} }