summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-06-16 12:29:54 +0200
committerTor Andersson <tor@ghostscript.com>2010-06-16 12:29:54 +0200
commit5795eaee9455031dead3dff50d1ab2d06c5f9915 (patch)
treebd5f9f2e8c29c4fa24c90f5f9d1ff6d25714dd2b /fitz
parentef055a22a6ad0c28f57dc9f783124b51903f3106 (diff)
downloadmupdf-5795eaee9455031dead3dff50d1ab2d06c5f9915.tar.xz
Do runtime endianness test instead of relying on unreliable preprocessor macros.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/base_cpudep.c6
-rw-r--r--fitz/fitz_base.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/fitz/base_cpudep.c b/fitz/base_cpudep.c
index 980bc9d8..f17d6a25 100644
--- a/fitz/base_cpudep.c
+++ b/fitz/base_cpudep.c
@@ -10,6 +10,12 @@ Glenn Kennard <d98gk@efd.lth.se>
/* global run-time constant */
unsigned fz_cpuflags = 0;
+int fz_isbigendian(void)
+{
+ static const int one = 1;
+ return *(char*)&one == 0;
+}
+
#ifndef HAVE_CPUDEP
void fz_cpudetect(void)
diff --git a/fitz/fitz_base.h b/fitz/fitz_base.h
index b6ca40c4..94197a1a 100644
--- a/fitz/fitz_base.h
+++ b/fitz/fitz_base.h
@@ -86,6 +86,8 @@ extern void fz_cpudetect(void);
/* treat as constant! */
extern unsigned fz_cpuflags;
+int fz_isbigendian(void);
+
/*
* Base Fitz runtime.
*/