diff options
author | Manish Singh <yosh@src.gnome.org> | 1998-10-27 06:19:42 +0000 |
---|---|---|
committer | Manish Singh <yosh@src.gnome.org> | 1998-10-27 06:19:42 +0000 |
commit | 215251e99dcaa18bda8ed70cdd8f0edc27de5f41 (patch) | |
tree | f7ba23e5dd94fa7a0c3e2ee5bf3f0d68f5342be5 /tests | |
parent | a8d04aa3e3f6fb7aab3d1f3700d3f0be72981b7f (diff) |
reimplemented the endian stuff, using inline asm for x86. #define g_htonl
* glib.h: reimplemented the endian stuff, using inline asm for x86.
#define g_htonl and friends.
* testglib.c: new tests for the endian stuff
* configure.in: care for AIX in gmodule linker flags test (from Joel Becker
<jlbec@raleigh.ibm.com>). Check $host_os for linux instead of existance of
/usr/include/linux
* gutils.c: buh-bye evil warning. Thou hast been #ifdef'd out of thine
existance!
-Yosh
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testglib.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/testglib.c b/tests/testglib.c index e948a10af..ed32765de 100644 --- a/tests/testglib.c +++ b/tests/testglib.c @@ -321,6 +321,11 @@ main (int argc, #endif }; guint n_dirname_checks = sizeof (dirname_checks) / sizeof (dirname_checks[0]); + guint16 gu16t1 = 0x44afU, gu16t2 = 0xaf44U; + guint32 gu32t1 = 0x02a7f109U, gu32t2 = 0x09f1a702U; +#ifdef HAVE_GINT64 + guint64 gu64t1 = 0x1d636b02300a7aa7U, gu64t2 = 0xa77a0a30026b631dU; +#endif g_print ("TestGLib v%u.%u.%u (i:%u b:%u)\n", glib_major_version, @@ -811,5 +816,18 @@ main (int argc, string = NULL; g_print (string); + g_print ("endian macro tests..."); +#if G_BYTE_ORDER == G_BIG_ENDIAN + g_print ("big endian..."); +#else + g_print ("little endian..."); +#endif + g_assert (GUINT16_SWAP_LE_BE (gu16t1) == gu16t2); + g_assert (GUINT32_SWAP_LE_BE (gu32t1) == gu32t2); +#ifdef HAVE_GINT64 + g_assert (GUINT64_SWAP_LE_BE (gu64t1) == gu64t2); +#endif + g_print ("ok\n"); + return 0; } |