Re: Glib bithacks



Le vendredi 04 novembre 2005 à 20:29 -0600, Federico Mena Quintero a
écrit :
> On Fri, 2005-11-04 at 20:23 -0500, Behdad Esfahbod wrote:
> > +#define IS(Type, Class)        (((guint)1 << (Type)) & (Class) ?
> > 1 : 0)
> > +#define OR(Type, Rest) (((guint)1 << (Type)) | (Rest))

impressive ! i'm sad that gcc doesn't do it by itself. Maybe a bug
should be filled because this kind of optimization is great.

Having a look at assembly ...

instructions :

	pango	| behad
ISDIGIT	  5	|   5
ISALPHA	  13	|   4
ISMARK	  9	|   4


branching instructions :

	pango	| behad
ISDIGIT	  0	|   0
ISALPHA	  4	|   0
ISMARK	  2	|   0
	
amazing :)

-- 
Benoît Dejean <benoit placenet org>

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]