Contents

Byte-Order Utilities

Overview

When handling binary data transmitted or shared across platforms, you need be concerned with how each platform stores numerical values. A platform stores values either in big-endian or little-endian format. On big-endian machines, such as PowerPC machines, values are stored with the most-significant bytes first in memory; on little-endian machines, such as Pentium machines, values are stored with the least-significant bytes first. A multibyte value transmitted to a platform with a different format will be misinterpreted if it is not converted properly by one of the computers.

You identify the native format of the current platform using the CFByteOrderGetCurrent() function. Use functions such as CFSwapInt32BigToHost(_:) and CFConvertFloat32HostToSwapped(_:) to convert values between different byte order formats.

Topics

Core Foundation Byte Order Utilities Miscellaneous Functions

Data Types

Constants

See Also

Related Documentation

  • Memory Management Programming Guide for Core Foundation

Utilities