Re: Endian portability #defines in GLIB



> It's too big ;-)

Well, it was mostly autogenerated. ;)
 
> I have been working on a patch to `glib' to move some of the #ifdef
> testing into `configure.in'.  This way, instead of having 
> 
> 	#ifdef FOO
> 	# define BAR A
> 	#else
> 	# define BAR B
> 	#endif
> 
> in `glib.h', you will find
> 
> 	#define BAR B
> 
> (or A, depending on FOO), magically defined in `glibconfig.h'.  The nice
> part is that you should be able to do
> 
> 	case $sizeof_int in
> 	2) bits=16;;
> 	4) bits=32;;
> 	8) bits=64;;
> 	*) echo wow;;
> 	esac
> 	cat >>glibconfig.h <<EOF
> 	#define GINT_FROM_BE(from)	GINT${bits}_FROM_BE(from)
> 	#define GINT_FROM_LE(from)	GINT${bits}_FROM_LE(from)
> 	EOF
> 
> Much better, don't you think (nice to have another macro processor
> before `cpp').
> 
> I'll try to send it in tomorrow.  Can you wait till then?

Ok, I like this idea. I'll hold off till tomorrow.

-Yosh



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