configure.in added test for endianness

* configure.in
* acconfig.h: added test for endianness

* glib.h: #define endian macros for system and some conversions
between byte order

-Yosh
This commit is contained in:
Manish Singh 1998-10-20 10:43:39 +00:00
parent b6a21eb5f5
commit 1a3648688f
12 changed files with 166 additions and 0 deletions

View File

@ -1,3 +1,11 @@
Tue Oct 20 03:32:58 PDT 1998 Manish Singh <yosh@gimp.org>
* configure.in
* acconfig.h: added test for endianness
* glib.h: #define endian macros for system and some conversions
between byte order
Thu Oct 8 06:47:27 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,11 @@
Tue Oct 20 03:32:58 PDT 1998 Manish Singh <yosh@gimp.org>
* configure.in
* acconfig.h: added test for endianness
* glib.h: #define endian macros for system and some conversions
between byte order
Thu Oct 8 06:47:27 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,11 @@
Tue Oct 20 03:32:58 PDT 1998 Manish Singh <yosh@gimp.org>
* configure.in
* acconfig.h: added test for endianness
* glib.h: #define endian macros for system and some conversions
between byte order
Thu Oct 8 06:47:27 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,11 @@
Tue Oct 20 03:32:58 PDT 1998 Manish Singh <yosh@gimp.org>
* configure.in
* acconfig.h: added test for endianness
* glib.h: #define endian macros for system and some conversions
between byte order
Thu Oct 8 06:47:27 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,11 @@
Tue Oct 20 03:32:58 PDT 1998 Manish Singh <yosh@gimp.org>
* configure.in
* acconfig.h: added test for endianness
* glib.h: #define endian macros for system and some conversions
between byte order
Thu Oct 8 06:47:27 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,11 @@
Tue Oct 20 03:32:58 PDT 1998 Manish Singh <yosh@gimp.org>
* configure.in
* acconfig.h: added test for endianness
* glib.h: #define endian macros for system and some conversions
between byte order
Thu Oct 8 06:47:27 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,11 @@
Tue Oct 20 03:32:58 PDT 1998 Manish Singh <yosh@gimp.org>
* configure.in
* acconfig.h: added test for endianness
* glib.h: #define endian macros for system and some conversions
between byte order
Thu Oct 8 06:47:27 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,11 @@
Tue Oct 20 03:32:58 PDT 1998 Manish Singh <yosh@gimp.org>
* configure.in
* acconfig.h: added test for endianness
* glib.h: #define endian macros for system and some conversions
between byte order
Thu Oct 8 06:47:27 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -213,6 +213,8 @@ case x$glib_cv_hasinline in
xyes) AC_DEFINE(G_HAVE_INLINE)
esac
dnl for bytesex stuff
AC_C_BIGENDIAN
dnl header file checks
AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H))

48
glib.h
View File

@ -455,6 +455,54 @@ extern "C" {
#endif /* !G_DISABLE_CHECKS */
/* Portable endian checks and conversions
*/
#define G_LITTLE_ENDIAN 1234
#define G_BIG_ENDIAN 4321
#define G_PDP_ENDIAN 3412 / /* unused, need specific PDP check */
#ifdef WORDS_BIGENDIAN
#define G_BYTE_ORDER G_BIG_ENDIAN
#else
#define G_BYTE_ORDER G_LITTLE_ENDIAN
#endif
#define GULONG_SWAP_LE_BE(long_val) (((gulong) \
(((gulong) (long_val)) & 0x000000ffU) << 24) | \
(((gulong) (long_val)) & 0x0000ff00U) << 8) | \
(((gulong) (long_val)) & 0x00ff0000U) >> 8) | \
(((gulong) (long_val)) & 0xff000000U) >> 24)))
#define GULONG_SWAP_LE_PDP(long_val) (((gulong) \
(((gulong) (long_val)) & 0x0000ffffU) << 16) | \
(((gulong) (long_val)) & 0xffff0000U) >> 16)))
#define GULONG_SWAP_BE_PDP(long_val) (((gulong) \
(((gulong) (long_val)) & 0x000000ffU) << 8) | \
(((gulong) (long_val)) & 0x0000ff00U) >> 8) | \
(((gulong) (long_val)) & 0x00ff0000U) << 8) | \
(((gulong) (long_val)) & 0xff000000U) >> 8)))
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
# define GLONG_TO_LE(long_val) ((glong) (long_val))
# define GULONG_TO_LE(long_val) ((gulong) (long_val))
# define GLONG_TO_BE(long_val) ((glong) GULONG_SWAP_LE_BE (long_val))
# define GULONG_TO_BE(long_val) (GULONG_SWAP_LE_BE (long_val))
# define GLONG_FROM_LE(long_val) ((glong) (long_val))
# define GULONG_FROM_LE(long_val) ((gulong) (long_val))
# define GLONG_FROM_BE(long_val) ((glong) GULONG_SWAP_LE_BE (long_val))
# define GULONG_FROM_BE(long_val) (GULONG_SWAP_LE_BE (long_val))
#elif G_BYTE_ORDER == G_BIG_ENDIAN
# define GLONG_TO_LE(long_val) ((glong) GULONG_SWAP_LE_BE (long_val))
# define GULONG_TO_LE(long_val) (GULONG_SWAP_LE_BE (long_val))
# define GLONG_TO_BE(long_val) ((glong) (long_val))
# define GULONG_TO_BE(long_val) ((gulong) (long_val))
# define GLONG_FROM_LE(long_val) ((glong) GULONG_SWAP_LE_BE (long_val))
# define GULONG_FROM_LE(long_val) (GULONG_SWAP_LE_BE (long_val))
# define GLONG_FROM_BE(long_val) ((glong) (long_val))
# define GULONG_FROM_BE(long_val) ((gulong) (long_val))
#endif
/* Provide type definitions for commonly used types.
* These are useful because a "gint8" can be adjusted
* to be 1 byte (8 bits) on all platforms. Similarly and

View File

@ -455,6 +455,54 @@ extern "C" {
#endif /* !G_DISABLE_CHECKS */
/* Portable endian checks and conversions
*/
#define G_LITTLE_ENDIAN 1234
#define G_BIG_ENDIAN 4321
#define G_PDP_ENDIAN 3412 / /* unused, need specific PDP check */
#ifdef WORDS_BIGENDIAN
#define G_BYTE_ORDER G_BIG_ENDIAN
#else
#define G_BYTE_ORDER G_LITTLE_ENDIAN
#endif
#define GULONG_SWAP_LE_BE(long_val) (((gulong) \
(((gulong) (long_val)) & 0x000000ffU) << 24) | \
(((gulong) (long_val)) & 0x0000ff00U) << 8) | \
(((gulong) (long_val)) & 0x00ff0000U) >> 8) | \
(((gulong) (long_val)) & 0xff000000U) >> 24)))
#define GULONG_SWAP_LE_PDP(long_val) (((gulong) \
(((gulong) (long_val)) & 0x0000ffffU) << 16) | \
(((gulong) (long_val)) & 0xffff0000U) >> 16)))
#define GULONG_SWAP_BE_PDP(long_val) (((gulong) \
(((gulong) (long_val)) & 0x000000ffU) << 8) | \
(((gulong) (long_val)) & 0x0000ff00U) >> 8) | \
(((gulong) (long_val)) & 0x00ff0000U) << 8) | \
(((gulong) (long_val)) & 0xff000000U) >> 8)))
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
# define GLONG_TO_LE(long_val) ((glong) (long_val))
# define GULONG_TO_LE(long_val) ((gulong) (long_val))
# define GLONG_TO_BE(long_val) ((glong) GULONG_SWAP_LE_BE (long_val))
# define GULONG_TO_BE(long_val) (GULONG_SWAP_LE_BE (long_val))
# define GLONG_FROM_LE(long_val) ((glong) (long_val))
# define GULONG_FROM_LE(long_val) ((gulong) (long_val))
# define GLONG_FROM_BE(long_val) ((glong) GULONG_SWAP_LE_BE (long_val))
# define GULONG_FROM_BE(long_val) (GULONG_SWAP_LE_BE (long_val))
#elif G_BYTE_ORDER == G_BIG_ENDIAN
# define GLONG_TO_LE(long_val) ((glong) GULONG_SWAP_LE_BE (long_val))
# define GULONG_TO_LE(long_val) (GULONG_SWAP_LE_BE (long_val))
# define GLONG_TO_BE(long_val) ((glong) (long_val))
# define GULONG_TO_BE(long_val) ((gulong) (long_val))
# define GLONG_FROM_LE(long_val) ((glong) GULONG_SWAP_LE_BE (long_val))
# define GULONG_FROM_LE(long_val) (GULONG_SWAP_LE_BE (long_val))
# define GLONG_FROM_BE(long_val) ((glong) (long_val))
# define GULONG_FROM_BE(long_val) ((gulong) (long_val))
#endif
/* Provide type definitions for commonly used types.
* These are useful because a "gint8" can be adjusted
* to be 1 byte (8 bits) on all platforms. Similarly and

View File

@ -12,6 +12,10 @@
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
#undef ENABLE_MEM_CHECK
#undef ENABLE_MEM_PROFILE