• Antelope Release 5.9 Mac OS X 10.13.2 2019-05-01

 

NAME

byteorder - dealing with byte order issues in Antelope

DESCRIPTION

The predominant machine architectures are divided into two classes, depending on how they number (or address) bytes within a multibyte type like an int or a double. Generally, programs can ignore these differences, because they are internally transparent. However, when there's an external representation, either with a physical file, or in a packet transmitted on a network, the byte order becomes an issue.

Antelope deals with the issue internally using the #define macro WORDS_BIGENDIAN, which differs depending on the architecture. Many internal Antelope routines implicitly or explicitly use this macro to specify how to copy bytes in an architecture dependent way.

You may also use this macro (defined in deviants.h) to determine the local byte order. However, this requires that you embed in your code different methods for each architecture. It's much better to use the routines in byteswap(3), which vary from one architecture to another without complicating your code.

While many conversions simply involve sometimes reordering the bytes, the conversions are more complex when input and output sizes differ, or floating point values are involved.

BUGS AND CAVEATS

Please use the byteswap(3) routines.

SEE ALSO

byteswap(3)
tr2ext(3)
stuffPkt(3)
unstuffPkt(3)

AUTHOR

Daniel Quinlan
Printer icon