Re: Endian portability #defines in GLIB
- From: Raja R Harinath <harinath cs umn edu>
- To: Manish Singh <yosh gimp org>
- Cc: Josh MacDonald <jmacd cs berkeley edu>, gtk-devel-list redhat com
- Subject: Re: Endian portability #defines in GLIB
- Date: 22 Oct 1998 21:07:33 -500
Manish Singh <yosh@gimp.org> writes:
> > Perhaps we could add #defines for ntohs, htons, ntohl, and htonl
> > implemented in terms of the more verbose forms Tim suggests.
>
> Ok, I've revised the endian stuff somewhat. Especially, I've special
> cased different sized types. If there aren't any objections, I will
> commit this:
[snip]
It's too big ;-)
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?
- Hari
--
Raja R Harinath ------------------------------ harinath@cs.umn.edu
"When all else fails, read the instructions." -- Cahn's Axiom
"Our policy is, when in doubt, do the right thing." -- Roy L Ash
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]