Next: , Up: Bytevectors   [Contents][Index]


6.6.12.1 Endianness

Some of the following procedures take an endianness parameter. The endianness is defined as the order of bytes in multi-byte numbers: numbers encoded in big endian have their most significant bytes written first, whereas numbers encoded in little endian have their least significant bytes first10.

Little-endian is the native endianness of the IA32 architecture and its derivatives, while big-endian is native to SPARC and PowerPC, among others. The native-endianness procedure returns the native endianness of the machine it runs on.

Scheme Procedure: native-endianness
C Function: scm_native_endianness ()

Return a value denoting the native endianness of the host machine.

Scheme Macro: endianness symbol

Return an object denoting the endianness specified by symbol. If symbol is neither big nor little then an error is raised at expand-time.

C Variable: scm_endianness_big
C Variable: scm_endianness_little

The objects denoting big- and little-endianness, respectively.


Footnotes

(10)

Big-endian and little-endian are the most common “endiannesses”, but others do exist. For instance, the GNU MP library allows word order to be specified independently of byte order (see Integer Import and Export in The GNU Multiple Precision Arithmetic Library Manual).