From 2793785e0cc5dd5a4bd823e52266df796a065d1c Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 10 Oct 2015 16:34:03 -0400 Subject: [PATCH] Rasterizer: Get rid of a clamp macro --- Source/Core/VideoBackends/Software/Rasterizer.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/Core/VideoBackends/Software/Rasterizer.cpp b/Source/Core/VideoBackends/Software/Rasterizer.cpp index d4977f7671..f8e746c598 100644 --- a/Source/Core/VideoBackends/Software/Rasterizer.cpp +++ b/Source/Core/VideoBackends/Software/Rasterizer.cpp @@ -18,8 +18,6 @@ #define BLOCK_SIZE 2 -#define CLAMP(x, a, b) (x>b)?b:(x 0 && (tm0.min_filter & 4)) || (lod <= 0 && tm0.mag_filter)); - // order of checks matters - // should be: - // if lod > max then max - // else if lod < min then min - lod = CLAMP(lod, (s32)tm1.min_lod, (s32)tm1.max_lod); + // NOTE: The order of comparisons for this clamp check matters. + if (lod > static_cast(tm1.max_lod)) + lod = static_cast(tm1.max_lod); + else if (lod < static_cast(tm1.min_lod)) + lod = static_cast(tm1.min_lod); + *lodp = lod; }