mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
Use a more optimized g_bit_storage() when gcc is available. (#371670,
2007-01-09 Behdad Esfahbod <behdad@gnome.org> * glib/gutils.h: Use a more optimized g_bit_storage() when gcc is available. (#371670, Daniel Elstner) svn path=/trunk/; revision=5234
This commit is contained in:
parent
4e4967a305
commit
6b6fd9bac8
@ -1,3 +1,8 @@
|
||||
2007-01-09 Behdad Esfahbod <behdad@gnome.org>
|
||||
|
||||
* glib/gutils.h: Use a more optimized g_bit_storage() when gcc is
|
||||
available. (#371670, Daniel Elstner)
|
||||
|
||||
2007-01-08 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gthread/gthread-posix.c (g_thread_impl_init): Don't
|
||||
|
@ -305,7 +305,8 @@ G_INLINE_FUNC guint
|
||||
g_bit_storage (gulong number)
|
||||
{
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__OPTIMIZE__)
|
||||
return number ? GLIB_SIZEOF_LONG * 8 - __builtin_clzl(number) : 1;
|
||||
return G_LIKELY (number) ?
|
||||
((GLIB_SIZEOF_LONG * 8 - 1) ^ __builtin_clzl(number)) + 1 : 1;
|
||||
#else
|
||||
register guint n_bits = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user