Add byteswap macros for gsize/gssize.

This commit is contained in:
Ryan Lortie 2009-11-30 19:50:21 -05:00
parent 2a78adc5e3
commit 74a970f754
5 changed files with 98 additions and 0 deletions

View File

@ -3057,6 +3057,10 @@ _______EOF
#define GUINT_TO_LE(val) ((guint) GUINT${gintbits}_TO_LE (val))
#define GINT_TO_BE(val) ((gint) GINT${gintbits}_TO_BE (val))
#define GUINT_TO_BE(val) ((guint) GUINT${gintbits}_TO_BE (val))
#define GSIZE_TO_LE(val) ((gsize) GUINT${gsizebits}_TO_LE (val))
#define GSSIZE_TO_LE(val) ((gssize) GINT${gsizebits}_TO_LE (val))
#define GSIZE_TO_BE(val) ((gsize) GUINT${gsizebits}_TO_BE (val))
#define GSSIZE_TO_BE(val) ((gssize) GINT${gsizebits}_TO_BE (val))
#define G_BYTE_ORDER $g_byte_order
#define GLIB_SYSDEF_POLLIN =$g_pollin
@ -3256,6 +3260,7 @@ esac
gintbits=`expr $ac_cv_sizeof_int \* 8`
glongbits=`expr $ac_cv_sizeof_long \* 8`
gsizebits=`expr $ac_cv_sizeof_size_t \* 8`
case $ac_cv_sizeof_void_p in
$ac_cv_sizeof_int)

View File

@ -218,6 +218,18 @@ GULONG_FROM_LE
GULONG_TO_BE
GULONG_TO_LE
<SUBSECTION>
GSIZE_FROM_BE
GSIZE_FROM_LE
GSIZE_TO_BE
GSIZE_TO_LE
<SUBSECTION>
GSSIZE_FROM_BE
GSSIZE_FROM_LE
GSSIZE_TO_BE
GSSIZE_TO_LE
<SUBSECTION>
GINT16_FROM_BE
GINT16_FROM_LE

View File

@ -265,6 +265,78 @@ Converts a #gulong value from host byte order to little-endian.
@Returns: @val converted to little-endian.
<!-- ##### MACRO GSIZE_FROM_BE ##### -->
<para>
Converts a #gsize value from big-endian to the host byte order.
</para>
@val: a #gsize value in big-endian byte order.
@Returns: @val converted to host byte order.
<!-- ##### MACRO GSIZE_FROM_LE ##### -->
<para>
Converts a #gsize value from little-endian to host byte order.
</para>
@val: a #gsize value in little-endian byte order.
@Returns: @val converted to host byte order.
<!-- ##### MACRO GSIZE_TO_BE ##### -->
<para>
Converts a #gsize value from host byte order to big-endian.
</para>
@val: a #gsize value in host byte order.
@Returns: @val converted to big-endian byte order.
<!-- ##### MACRO GSIZE_TO_LE ##### -->
<para>
Converts a #gsize value from host byte order to little-endian.
</para>
@val: a #gsize value in host byte order.
@Returns: @val converted to little-endian.
<!-- ##### MACRO GSSIZE_FROM_BE ##### -->
<para>
Converts a #gssize value from big-endian to host byte order.
</para>
@val: a #gssize value in big-endian byte order.
@Returns: @val converted to host byte order.
<!-- ##### MACRO GSSIZE_FROM_LE ##### -->
<para>
Converts a #gssize value from little-endian to host byte order.
</para>
@val: a #gssize value in little-endian byte order.
@Returns: @val converted to host byte order.
<!-- ##### MACRO GSSIZE_TO_BE ##### -->
<para>
Converts a #gssize value from host byte order to big-endian.
</para>
@val: a #gssize value in host byte order.
@Returns: @val converted to big-endian.
<!-- ##### MACRO GSSIZE_TO_LE ##### -->
<para>
Converts a #gssize value from host byte order to little-endian.
</para>
@val: a #gssize value in host byte order.
@Returns: @val converted to little-endian.
<!-- ##### MACRO GINT16_FROM_BE ##### -->
<para>
Converts a #gint16 value from big-endian to host byte order.

View File

@ -335,6 +335,11 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
#define GINT_FROM_BE(val) (GINT_TO_BE (val))
#define GUINT_FROM_BE(val) (GUINT_TO_BE (val))
#define GSIZE_FROM_LE(val) (GSIZE_TO_LE (val))
#define GSSIZE_FROM_LE(val) (GSSIZE_TO_LE (val))
#define GSIZE_FROM_BE(val) (GSIZE_TO_BE (val))
#define GSSIZE_FROM_BE(val) (GSSIZE_TO_BE (val))
/* Portable versions of host-network order stuff
*/

View File

@ -239,6 +239,10 @@ union _GSystemThread
#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
#define GSIZE_TO_LE(val) ((gsize) GUINT32_TO_LE (val))
#define GSSIZE_TO_LE(val) ((gssize) GINT32_TO_LE (val))
#define GSIZE_TO_BE(val) ((gsize) GUINT32_TO_BE (val))
#define GSSIZE_TO_BE(val) ((gssize) GINT32_TO_BE (val))
#define G_BYTE_ORDER G_LITTLE_ENDIAN
#define GLIB_SYSDEF_POLLIN =1