Big endian define garbage

This commit is contained in:
John Lorentzson 2025-04-12 17:38:29 +02:00
parent 21323b964c
commit 962bb9d477

View file

@ -14,10 +14,6 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#ifndef __BYTE_ORDER__
#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
#endif
typedef struct RenderBackend_Surface
{
unsigned char *pixels;
@ -120,7 +116,7 @@ void RenderBackend_UploadSurface(RenderBackend_Surface *surface, const unsigned
for (size_t x = 0; x < width; ++x) {
int srcr = x * 3;
int dstr = x * 4;
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#ifdef LITTLE_ENDIAN
surface->pixels[dstl + dstr + 0] = pixels[srcl + srcr + 2];
surface->pixels[dstl + dstr + 1] = pixels[srcl + srcr + 1];
surface->pixels[dstl + dstr + 2] = pixels[srcl + srcr + 0];
@ -190,7 +186,7 @@ ATTRIBUTE_HOT void RenderBackend_Blit(RenderBackend_Surface *source_surface, con
}
else
{
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#ifdef LITTLE_ENDIAN
*destination_pointer++ = *source_pointer++;
*destination_pointer++ = *source_pointer++;
*destination_pointer++ = *source_pointer++;
@ -262,7 +258,7 @@ ATTRIBUTE_HOT void RenderBackend_ColourFill(RenderBackend_Surface *surface, cons
for (long i = 0; i < rect_clamped.right - rect_clamped.left; ++i)
{
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#ifdef LITTLE_ENDIAN
*destination_pointer++ = blue;
*destination_pointer++ = green;
*destination_pointer++ = red;