summaryrefslogtreecommitdiff
path: root/draw/imageunpack.c
diff options
context:
space:
mode:
Diffstat (limited to 'draw/imageunpack.c')
-rw-r--r--draw/imageunpack.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/draw/imageunpack.c b/draw/imageunpack.c
index 6e4e7f85..536e43d1 100644
--- a/draw/imageunpack.c
+++ b/draw/imageunpack.c
@@ -31,6 +31,12 @@ static void decodetile(fz_pixmap *pix, int skip, float *decode)
justinvert &= min[i] == 255 && max[i] == 0 && sub[i] == -255;
}
+ unsigned mask;
+ if (fz_isbigendian())
+ mask = 0x00ff00ff;
+ else
+ mask = 0xff00ff00;
+
if (!needed)
return;
@@ -51,11 +57,7 @@ static void decodetile(fz_pixmap *pix, int skip, float *decode)
wh = wh - 2 * hwh;
while(hwh--) {
unsigned in = *wp;
-#if BYTE_ORDER == LITTLE_ENDIAN
- unsigned out = in ^ 0xff00ff00;
-#else
- unsigned out = in ^ 0x00ff00ff;
-#endif
+ unsigned out = in ^ mask;
*wp++ = out;
}
p = (byte *)wp;