From 804b47c4ea7cbd77ea018be20a8e1629ddc80ebd Mon Sep 17 00:00:00 2001 From: rexim Date: Sun, 29 Dec 2019 01:31:13 +0700 Subject: [PATCH] (#450) Use fmimf fmaxf --- src/game/level/platforms.c | 10 +++++----- src/math/extrema.h | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/game/level/platforms.c b/src/game/level/platforms.c index e066d1a3..6a670db9 100644 --- a/src/game/level/platforms.c +++ b/src/game/level/platforms.c @@ -86,7 +86,7 @@ int platforms_render(const Platforms *platforms, Rect world_viewport = camera_view_port(camera); Rect viewport = camera_view_port_screen(camera); - + if (rects_overlap( camera_rect( camera, @@ -96,12 +96,12 @@ int platforms_render(const Platforms *platforms, camera, text_pos) == false) { if (platform_rect.w > text_rect.w){ - text_pos.x = MAX(float, MIN(float, world_viewport.x, platform_rect.x + platform_rect.w - text_rect.w), - platform_rect.x); + text_pos.x = fmaxf(fminf(world_viewport.x, platform_rect.x + platform_rect.w - text_rect.w), + platform_rect.x); } if (platform_rect.h > text_rect.h){ - text_pos.y = MAX(float, MIN(float, world_viewport.y, platform_rect.y + platform_rect.h - text_rect.h), - platform_rect.y); + text_pos.y = fmaxf(fminf(world_viewport.y, platform_rect.y + platform_rect.h - text_rect.h), + platform_rect.y); } } diff --git a/src/math/extrema.h b/src/math/extrema.h index 1f49bd28..d0622942 100644 --- a/src/math/extrema.h +++ b/src/math/extrema.h @@ -9,7 +9,6 @@ return a > b ? a : b; \ } \ -MAX_INSTANCE(float) MAX_INSTANCE(int64_t) MAX_INSTANCE(size_t) #define MAX(type, a, b) max_##type(a, b) @@ -20,7 +19,6 @@ MAX_INSTANCE(size_t) return a < b ? a : b; \ } \ -MIN_INSTANCE(float) MIN_INSTANCE(int64_t) MIN_INSTANCE(size_t) #define MIN(type, a, b) min_##type(a, b) -- 2.44.0