summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-12-01 15:57:14 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-12-01 15:57:14 (GMT)
commit5caf9b228b9b4ce8ae36d80466dde70dea140698 (patch)
treed397770aa55b8c0b4c5a0a708b391438f04ece2a
parent32ff860387968a3a41a8bb6977562b06fea508c9 (diff)
downloadtk-5caf9b228b9b4ce8ae36d80466dde70dea140698.zip
tk-5caf9b228b9b4ce8ae36d80466dde70dea140698.tar.gz
tk-5caf9b228b9b4ce8ae36d80466dde70dea140698.tar.bz2
Fix [5fde07b1d5]: tkCanvas.c: use WORDS_BIGENDIAN
-rw-r--r--generic/tkCanvas.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c
index 874ecf7..2ff9ff3 100644
--- a/generic/tkCanvas.c
+++ b/generic/tkCanvas.c
@@ -2581,8 +2581,11 @@ DecomposeMaskToShiftAndBits(
#define OVERDRAW_PIXELS 32 /* How much larger we make the pixmap
* that the canvas objects are drawn into */
-/* From stackoverflow.com/questions/2100331/c-macro-definition-to-determine-big-endian-or-little-endian-machine */
-#define IS_BIG_ENDIAN (*(unsigned short *)"\0\xff" < 0x100)
+#ifdef WORDS_BIGENDIAN
+#define IS_BIG_ENDIAN 1
+#else
+#define IS_BIG_ENDIAN 0
+#endif
#define BYTE_SWAP16(n) ((((unsigned short)n)>>8) | (((unsigned short)n)<<8))
#define BYTE_SWAP32(n) (((n>>24)&0x000000FF) | ((n<<8)&0x00FF0000) | ((n>>8)&0x0000FF00) | ((n<<24)&0xFF000000))