diff --git a/src/internal/DotStarColorFeatures.h b/src/internal/DotStarColorFeatures.h index bc97765..3719d6f 100644 --- a/src/internal/DotStarColorFeatures.h +++ b/src/internal/DotStarColorFeatures.h @@ -208,7 +208,7 @@ public: { uint8_t* p = getPixelAddress(pPixels, indexPixel); - *p++ = 0xE0 | min(color.W, 31); // upper three bits are always 111 + *p++ = 0xE0 | (color.W < 31 ? color.W : 31); // upper three bits are always 111 *p++ = color.B; *p++ = color.G; *p = color.R; @@ -290,7 +290,7 @@ public: { uint8_t* p = getPixelAddress(pPixels, indexPixel); - *p++ = 0xE0 | min(color.W, 31); // upper three bits are always 111 + *p++ = 0xE0 | (color.W < 31 ? color.W : 31); // upper three bits are always 111 *p++ = color.G; *p++ = color.R; *p = color.B; diff --git a/src/internal/HtmlColor.cpp b/src/internal/HtmlColor.cpp index 6b23f16..018d58f 100644 --- a/src/internal/HtmlColor.cpp +++ b/src/internal/HtmlColor.cpp @@ -52,7 +52,7 @@ size_t HtmlColor::ToNumericalString(char* buf, size_t bufSize) const color >>= 4; } - buf[min(bufLen, 7)] = 0; + buf[(bufLen < 7 ? bufLen : 7)] = 0; } return 7; }