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
CFByteOrderGetCurrent()CFConvertDoubleHostToSwapped(_:)CFConvertDoubleSwappedToHost(_:)CFConvertFloat32HostToSwapped(_:)CFConvertFloat32SwappedToHost(_:)CFConvertFloat64HostToSwapped(_:)CFConvertFloat64SwappedToHost(_:)CFConvertFloatHostToSwapped(_:)CFConvertFloatSwappedToHost(_:)CFSwapInt16(_:)CFSwapInt16BigToHost(_:)CFSwapInt16HostToBig(_:)CFSwapInt16HostToLittle(_:)CFSwapInt16LittleToHost(_:)CFSwapInt32(_:)CFSwapInt32BigToHost(_:)CFSwapInt32HostToBig(_:)CFSwapInt32HostToLittle(_:)CFSwapInt32LittleToHost(_:)CFSwapInt64(_:)CFSwapInt64BigToHost(_:)CFSwapInt64HostToBig(_:)CFSwapInt64HostToLittle(_:)CFSwapInt64LittleToHost(_:)
Data Types
Constants
See Also
Related Documentation
- Memory Management Programming Guide for Core Foundation