From: Emmanuele Bassi Date: Thu, 17 Apr 2008 11:29:26 +0000 (+0000) Subject: Use the macro GLib provides for byte-swapping as it can be optimized. X-Git-Tag: GLIB_2_17_0~76 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62b18e67b7ef12b0475e12b631a7f384030567de;p=platform%2Fupstream%2Fglib.git Use the macro GLib provides for byte-swapping as it can be optimized. 2008-04-17 Emmanuele Bassi * glib/gchecksum.c: (sha_byte_reverse): Use the macro GLib provides for byte-swapping as it can be optimized. (g_checksum_update): Fix a compiler warning. svn path=/trunk/; revision=6861 --- diff --git a/ChangeLog b/ChangeLog index 23f6821..0ba6110 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-04-17 Emmanuele Bassi + + * glib/gchecksum.c: + (sha_byte_reverse): Use the macro GLib provides for byte-swapping + as it can be optimized. + + (g_checksum_update): Fix a compiler warning. + 2008-04-15 Mukund Sivaraman * gio/gfile.c: Fixed typos in gtk-doc comments. diff --git a/glib/gchecksum.c b/glib/gchecksum.c index ded85ca..0b0ce54 100644 --- a/glib/gchecksum.c +++ b/glib/gchecksum.c @@ -122,10 +122,7 @@ sha_byte_reverse (guint32 *buffer, length /= sizeof (guint32); while (length--) { - *buffer = ((guint32) (((*buffer & (guint32) 0x000000ffU) << 24) | - ((*buffer & (guint32) 0x0000ff00U) << 8) | - ((*buffer & (guint32) 0x00ff0000U) >> 8) | - ((*buffer & (guint32) 0xff000000U) >> 24))); + *buffer = GUINT32_SWAP_LE_BE (*buffer); ++buffer; } } @@ -1204,7 +1201,7 @@ g_checksum_update (GChecksum *checksum, g_return_if_fail (data != NULL); if (length < 0) - length = strlen (data); + length = strlen ((const gchar *) data); if (checksum->digest_str) {