diff options
author | Tor Andersson <tor@ghostscript.com> | 2010-06-16 12:29:54 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2010-06-16 12:29:54 +0200 |
commit | 5795eaee9455031dead3dff50d1ab2d06c5f9915 (patch) | |
tree | bd5f9f2e8c29c4fa24c90f5f9d1ff6d25714dd2b /fitz | |
parent | ef055a22a6ad0c28f57dc9f783124b51903f3106 (diff) | |
download | mupdf-5795eaee9455031dead3dff50d1ab2d06c5f9915.tar.xz |
Do runtime endianness test instead of relying on unreliable preprocessor macros.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/base_cpudep.c | 6 | ||||
-rw-r--r-- | fitz/fitz_base.h | 2 |
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. */ |