__WORDSIZE doesn't seem to be available on platforms other than Mac or Linux, and best practices are for user-level code not to rely on it anyhow, since it's meant to be an internal macro. Fortunately, autoconf already has a way of determining the word size at configure time, so it can be passed into the compiler. This should work on any platform and has been tested on all of the Un*x platforms we support (Linux, Mac, FreeBSD, Solaris.)

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.4.x@1550 632fc199-4ca6-4c93-a231-07263d6284db
This commit is contained in:
DRC
2015-05-15 19:09:44 +00:00
parent 44320a210b
commit 3ebcc3206f
6 changed files with 21 additions and 25 deletions

View File

@@ -32,10 +32,11 @@ SIMD-enabled libjpeg-turbo MIPS build was executed with the -nosmooth option on
a MIPS machine that lacked DSPr2 support. The MIPS SIMD routines for h2v1 and a MIPS machine that lacked DSPr2 support. The MIPS SIMD routines for h2v1 and
h2v2 merged upsampling were not properly checking for the existence of DSPr2. h2v2 merged upsampling were not properly checking for the existence of DSPr2.
[6] Performance has been improved significantly on 64-bit Mac platforms [6] Performance has been improved significantly on 64-bit non-Linux and
(particularly compression performance.) Due to an oversight, the 64-bit non-Windows platforms (generally 10-20% faster compression and 5-10% faster
version of the accelerated Huffman codec was not being compiled in when decompression.) Due to an oversight, the 64-bit version of the accelerated
libjpeg-turbo was built on OS X. Oops. Huffman codec was not being compiled in when libjpeg-turbo was built on
platforms other than Windows or Linux. Oops.
[7] Fixed an extremely rare bug in the Huffman encoder that caused 64-bit [7] Fixed an extremely rare bug in the Huffman encoder that caused 64-bit
builds of libjpeg-turbo to incorrectly encode a few specific test images when builds of libjpeg-turbo to incorrectly encode a few specific test images when

View File

@@ -50,6 +50,8 @@ if test "x$exec_prefix" = "xNONE"; then
exec_prefix=${prefix} exec_prefix=${prefix}
fi fi
AC_CHECK_SIZEOF(size_t)
if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib'; then
LIBDIR=`eval echo ${libdir}` LIBDIR=`eval echo ${libdir}`
LIBDIR=`eval echo $LIBDIR` LIBDIR=`eval echo $LIBDIR`
@@ -58,10 +60,9 @@ if test "x${libdir}" = 'x${exec_prefix}/lib' -o "x${libdir}" = 'x${prefix}/lib';
darwin*) darwin*)
;; ;;
*) *)
AC_CHECK_SIZEOF(long) if test "${ac_cv_sizeof_size_t}" = "8"; then
if test "${ac_cv_sizeof_long}" = "8"; then
libdir='${exec_prefix}/lib64' libdir='${exec_prefix}/lib64'
elif test "${ac_cv_sizeof_long}" = "4"; then elif test "${ac_cv_sizeof_size_t}" = "4"; then
libdir='${exec_prefix}/lib32' libdir='${exec_prefix}/lib32'
fi fi
;; ;;

View File

@@ -21,9 +21,6 @@
#include "jpeglib.h" #include "jpeglib.h"
#include "jchuff.h" /* Declarations shared with jcphuff.c */ #include "jchuff.h" /* Declarations shared with jcphuff.c */
#include <limits.h> #include <limits.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
/* /*
* NOTE: If USE_CLZ_INTRINSIC is defined, then clz/bsr instructions will be * NOTE: If USE_CLZ_INTRINSIC is defined, then clz/bsr instructions will be
@@ -379,11 +376,11 @@ dump_buffer (working_state * state)
} \ } \
} }
#if !defined(_WIN32) && !defined(__WORDSIZE) #if !defined(_WIN32) && !defined(SIZEOF_SIZE_T)
#error __WORDSIZE is not defined #error Cannot determine word size
#endif #endif
#if __WORDSIZE==64 || defined(_WIN64) #if SIZEOF_SIZE_T==8 || defined(_WIN64)
#define EMIT_BITS(code, size) { \ #define EMIT_BITS(code, size) { \
CHECKBUF47() \ CHECKBUF47() \

View File

@@ -32,9 +32,6 @@
/* Define to 1 if you have the <stdlib.h> header file. */ /* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H #undef HAVE_STDLIB_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if the system has the type `unsigned char'. */ /* Define to 1 if the system has the type `unsigned char'. */
#undef HAVE_UNSIGNED_CHAR #undef HAVE_UNSIGNED_CHAR
@@ -71,3 +68,6 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */ /* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t #undef size_t
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T

View File

@@ -22,9 +22,6 @@
#include "jdhuff.h" /* Declarations shared with jdphuff.c */ #include "jdhuff.h" /* Declarations shared with jdphuff.c */
#include "jpegcomp.h" #include "jpegcomp.h"
#include "jstdhuff.c" #include "jstdhuff.c"
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
/* /*
@@ -422,11 +419,7 @@ jpeg_fill_bit_buffer (bitread_working_state * state,
} \ } \
} }
#if !defined(_WIN32) && !defined(__WORDSIZE) #if SIZEOF_SIZE_T==8 || defined(_WIN64)
#error __WORDSIZE is not defined
#endif
#if __WORDSIZE == 64 || defined(_WIN64)
/* Pre-fetch 48 bytes, because the holding register is 64-bit */ /* Pre-fetch 48 bytes, because the holding register is 64-bit */
#define FILL_BIT_BUFFER_FAST \ #define FILL_BIT_BUFFER_FAST \

View File

@@ -67,7 +67,11 @@ EXTERN(void) jpeg_make_d_derived_tbl
* necessary. * necessary.
*/ */
#if __WORDSIZE == 64 || defined(_WIN64) #if !defined(_WIN32) && !defined(SIZEOF_SIZE_T)
#error Cannot determine word size
#endif
#if SIZEOF_SIZE_T==8 || defined(_WIN64)
typedef size_t bit_buf_type; /* type of bit-extraction buffer */ typedef size_t bit_buf_type; /* type of bit-extraction buffer */
#define BIT_BUF_SIZE 64 /* size of buffer in bits */ #define BIT_BUF_SIZE 64 /* size of buffer in bits */