[Gllug] endian.h

James Watkins james at flare-dvd.com
Wed Feb 5 11:07:54 UTC 2003


I don't know if it's the recommended method but I've been using:

include <byteswap.h>
bswap_16(arg)
bswap_32(arg)
bswap_64(arg)

to do endianness conversion.

> -----Original Message-----
> From: Mike Brodbelt [mailto:mike at coruscant.demon.co.uk]
> Sent: 05 February 2003 02:18
> To: gllug at linux.co.uk
> Subject: [Gllug] endian.h
> 
> 
> 
> 
> 
> I'm interested in porting a small OpenBSD program to Linux, but I'm
> currently having grief getting parts of it to compile.
> 
> One of the source files makes use of functions like betoh32(),
> letoh32(), and also the 16bit variants of those. On OpenBSD, the
> function prototypes are in <machine/endian.h>, but, though 
> Linux has an
> endian.h file, those functions aren't in it.
> 
> What can I replace <machine/endian.h> with in order to get this to
> compile? Or is it a case of #ifdef'ing out those function calls, and
> replacing them with Linux equivalents?
> 
> TIA,
> 
> Mike.
> 
> 
> -- 
> Gllug mailing list  -  Gllug at linux.co.uk
> http://list.ftech.net/mailman/listinfo/gllug
> 

DISCLAIMER: This message contains confidential information and is intended
for To: and Cc: (name). If you are not the intended recipient you are
notified that disclosing, copying, distributing or taking any action in
reliance on the contents of this information is strictly prohibited. E-mail
transmission cannot be guaranteed to be secure or error-free as information
could be intercepted, corrupted, lost, destroyed, arrive late or incomplete,
or contain viruses. The sender therefore does not accept liability for any
errors or omissions in the contents of this message, which arise as a result
of e-mail transmission. The content of this e-mail does not necessarily
represent the company, its policies, or views, or those of its subsidiaries.
If verification is required please request a hard-copy version.
Please note that M2 Television monitors incoming and outgoing mail for
compliance with its Email Policy. This includes scanning incoming emails to
detect Viruses. 


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




More information about the GLLUG mailing list