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.
> 
It's not a bug, that's what happen when you lack proper abstract data
types. It's one of these cases where fixing the language is easier than
fixing the compiler :-)

Regards,

- David Turner

> 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>
> 
***********************************************************************************
Information contained in this email message is confidential and may be privileged, and is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster nds com and destroy the original message.
*********************************************************************************** 



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