[Gllug] endian.h

Mike Brodbelt mike at coruscant.demon.co.uk
Wed Feb 5 23:56:58 UTC 2003


On Wed, 2003-02-05 at 11:51, Tethys wrote:
> 
> Tethys writes:
> 
> >There are probably more efficient ways of doing it than the bit twiddling
> >I've done, but it should at least work...
> 
> Of course, using bitwise ORs instead of addition would probably help here.
> My excuse was that it was too early in the morning!

Thanks for the suggestions....

As it seems I can't just substitute one include file for another, would
it be cleaner to do "#ifdef LINUX" around the code segments in question
and substitute the BSD macros with cpu_to_be16 and similar?

In the first instance, I'd like to port the OpenBSD code I've got to
Linux, so I can use it, but in due course I'd like to adapt it to use
autoconf, and submit the changes back to the author (who's expressed an
interest in portability changes, but a lack of time to do them himself).

That being the case, I'm wondering if there's a "right" way to fix this
particular problem, or if everyone just defines macros to get round it.
There must be plenty of other code that needs to solve this problem - is
there any reason to prefer any particular solution?

Mike.


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list