From 88d1dfa94850612d61f7d732e443f242b96dd191 Mon Sep 17 00:00:00 2001 From: GravisZro Date: Tue, 21 May 2024 06:27:01 -0400 Subject: [PATCH] Replace `SET_MIN` with `std::min` --- 2dlib/surface.cpp | 10 ++++++---- grtext/grfont.cpp | 8 ++++---- lib/Macros.h | 1 - 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/2dlib/surface.cpp b/2dlib/surface.cpp index ed8cd5ca..9f81bbc5 100644 --- a/2dlib/surface.cpp +++ b/2dlib/surface.cpp @@ -85,6 +85,8 @@ * $NoKeywords: $ */ +#include + #include #include @@ -640,8 +642,8 @@ void grSurface::xlat16_24(char *data, int w, int h) { dptr = (char *)m_DataPtr; sptr = (uint16_t *)data; - height = SET_MIN(h, ddsfObj.h); - width = SET_MIN(w, ddsfObj.w); + height = std::min(h, ddsfObj.h); + width = std::min(w, ddsfObj.w); for (row = 0; row < height; row++) { dcol = 0; @@ -705,8 +707,8 @@ void grSurface::xlat32_16(char *data, int w, int h) { dptr = (uint16_t *)m_DataPtr; sptr = (unsigned *)data; rowsize_w = m_DataRowsize / 2; - height = SET_MIN(h, ddsfObj.h); - width = SET_MIN(w, ddsfObj.w); + height = std::min(h, ddsfObj.h); + width = std::min(w, ddsfObj.w); for (row = 0; row < height; row++) { for (col = 0; col < width; col++) { diff --git a/grtext/grfont.cpp b/grtext/grfont.cpp index 8733f1a9..4acb8872 100644 --- a/grtext/grfont.cpp +++ b/grtext/grfont.cpp @@ -959,8 +959,8 @@ void grfont_XlateColorChar(int bmp_handle, int x, int y, int index, tFontFileInf sptr = (uint16_t *)ft->char_data[index]; rowsize_w = bm_rowsize(bmp_handle, 0) / 2; - // height = SET_MIN(h, ddsfObj.h); - // width = SET_MIN(w, ddsfObj.w); + // height = std::min(h, ddsfObj.h); + // width = std::min(w, ddsfObj.w); dptr = dptr + (y * rowsize_w); if (ft->flags & FT_FMT4444) { @@ -999,8 +999,8 @@ void grfont_XlateColorGrayChar(int bmp_handle, int x, int y, int index, tFontFil sptr = (uint16_t *)ft->char_data[index]; rowsize_w = bm_rowsize(bmp_handle, 0) / 2; - // height = SET_MIN(h, ddsfObj.h); - // width = SET_MIN(w, ddsfObj.w); + // height = std::min(h, ddsfObj.h); + // width = std::min(w, ddsfObj.w); dptr = dptr + (y * rowsize_w); float recip32 = 1.0f / 32.0f; diff --git a/lib/Macros.h b/lib/Macros.h index 8f535a05..48f43b02 100644 --- a/lib/Macros.h +++ b/lib/Macros.h @@ -66,7 +66,6 @@ (a) = (b); \ (b) = _swap_var_; \ } while (0) -#define SET_MIN(a, b) (((a) < (b)) ? (a) : (b)) #define CHECK_FLAG(_var, _flag) ((_var) & (_flag)) #define makeword(_h, _l) (((_h) << 16) + ((_l) & 0xffff)) #define hiword(_v) ((_v) >> 16)