From f1b8ae2bc9ebcd534052fc1b81a10f24bf0630f6 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 9 Jan 2023 13:32:44 +1100 Subject: Use unsigned literal and temporary to stop conversion warnings for each includer. --- src/Geometry.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Geometry.h b/src/Geometry.h index 4fd90afad..354f3ea25 100644 --- a/src/Geometry.h +++ b/src/Geometry.h @@ -200,16 +200,18 @@ public: // Red, green and blue values as bytes 0..255 constexpr unsigned char GetRed() const noexcept { - return co & 0xff; + return co & 0xffU; } constexpr unsigned char GetGreen() const noexcept { - return (co >> 8) & 0xff; + return (co >> 8) & 0xffU; } constexpr unsigned char GetBlue() const noexcept { - return (co >> 16) & 0xff; + return (co >> 16) & 0xffU; } constexpr unsigned char GetAlpha() const noexcept { - return (co >> 24) & 0xff; + // Use a temporary here to prevent a 'Wconversion' warning from GCC + const int shifted = co >> 24; + return shifted & 0xffU; } // Red, green, blue, and alpha values as float 0..1.0 -- cgit v1.2.3