From d28a271fa819c076e2cedb87d9f305468e436b25 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Fri, 28 Jan 2022 09:43:21 -0700 Subject: SL-16418 add some big-endian future-proofing --- indra/llimage/llimage.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index fb02a131fd..ba7ee0b465 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -951,7 +951,11 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) U16 *dst = (U16 *)getData(); S32 count = getWidth() * getHeight(); llassert(count == getDataSize() / 2); +#ifdef LL_LITTLE_ENDIAN U16 val = (U16)(r | g << 8); +#else + U16 val = (U16)(r << 8 | g); +#endif std::fill_n(dst, count, val); break; } @@ -973,7 +977,11 @@ void LLImageRaw::clear(U8 r, U8 g, U8 b, U8 a) U32 *dst = (U32 *)getData(); S32 count = getWidth() * getHeight(); llassert(count == getDataSize() / 4); +#ifdef LL_LITTLE_ENDIAN U32 val = (U32)(r | g << 8 | b << 16 | a << 24); +#else + U32 val = (U32)(r << 24 | g << 16 | b << 8 | a); +#endif std::fill_n(dst, count, val); break; } -- cgit v1.2.3