Core Endian

Overview

Core Endian Reference provides routines for converting data between big endian and little endian format. These routines are useful for developers who write code that must compile for multiple architectures, including:

  • Macintosh developers who want to produce a universal binary.

  • QuickTime developers who want their code to run in Windows as well as in macOS.

Both QuickTime and Macintosh developers can use this API to handle reading or writing data to a file or network packet.

Macintosh developers can use this API to create and install callbacks that are invoked by macOS automatically when your application:

  • reads and writes custom resource data

  • sends or receives custom Apple events

  • reads and writes custom pasteboard data

The functions in this API are designed to do nothing when the target runtime is already in the desired format.

For more information see:

  • Universal Binary Programming Guidelines, Second Edition

  • QuickTime API Reference

Symbols

Working With Flippers

CoreEndianInstallFlipper

Installs a flipper callback for the specified data type.

Deprecated
CoreEndianGetFlipper

Obtains the flipper callback that is installed for the specified data type.

Deprecated
CoreEndianFlipData

Calls the flipper callback associated with the specified data type.

Deprecated

Changing the Endian Format

Endian16_Swap

Changes the endian format of an unsigned 16-bit integer.

Endian32_Swap

Changes the endian format of an unsigned 32-bit integer.

Endian64_Swap

Changes the endian format of an unsigned 64-bit integer.

Converting from Big-Endian to Native Format

EndianS16_BtoN

Converts a signed 16-bit big-endian value to the equivalent value in the computer’s native format.

EndianS32_BtoN

Converts a signed 32-bit big-endian value to the equivalent value in the computer’s native format.

EndianS64_BtoN

Converts a signed 64-bit big-endian value to the equivalent value in the computer’s native format.

EndianU16_BtoN

Converts an unsigned 16-bit big-endian value to the equivalent value in the computer’s native format.

EndianU32_BtoN

Converts an unsigned 32-bit big-endian value to the equivalent value in the computer’s native format.

EndianU64_BtoN

Converts an unsigned 64-bit big-endian value to the equivalent value in the computer’s native format.

Converting from Native Format to Big-Endian Format

EndianS16_NtoB

Converts a signed 16-bit value in the computer’s native format to the equivalent big-endian value.

EndianS32_NtoB

Converts a signed 32-bit value in the computer’s native format to the equivalent big-endian value.

EndianS64_NtoB

Converts a signed 64-bit value in the computer’s native format to the equivalent big-endian value.

EndianU16_NtoB

Converts an unsigned 16-bit value in the computer’s native format to the equivalent big-endian value.

EndianU32_NtoB

Converts an unsigned 32-bit value in the computer’s native format to the equivalent big-endian value.

EndianU64_NtoB

Converts an unsigned 64-bit value in the computer’s native format to the equivalent big-endian value.

Converting from Little-Endian Format to Native Format

EndianS16_LtoN

Converts a signed 16-bit little-endian value to the equivalent value in the computer’s native format.

EndianS32_LtoN

Converts a signed 32-bit little-endian value to the equivalent value in the computer’s native format.

EndianS64_LtoN

Converts a signed 64-bit little-endian value to the equivalent value in the computer’s native format.

EndianU16_LtoN

Converts an unsigned 16-bit little-endian value to the equivalent value in the computer’s native format.

EndianU32_LtoN

Converts an unsigned 32-bit little-endian value to the equivalent value in the computer’s native format.

EndianU64_LtoN

Converts an unsigned 64-bit little-endian value to the equivalent value in the computer’s native format.

Converting from Native Format to Little-Endian Format

EndianS16_NtoL

Converts a signed 16-bit value in the computer’s native format to the equivalent little-endian value.

EndianS32_NtoL

Converts a signed 32-bit value in the computer’s native format to the equivalent little-endian value.

EndianS64_NtoL

Converts a signed 64-bit value in the computer’s native format to the equivalent little-endian value.

EndianU16_NtoL

Converts an unsigned 16-bit value in the computer’s native format to the equivalent little-endian value.

EndianU32_NtoL

Converts an unsigned 32-bit value in the computer’s native format to the equivalent little-endian value.

EndianU64_NtoL

Converts an unsigned 64-bit value in the computer’s native format to the equivalent little-endian value.

Converting from Big-Endian to Little-Endian Format

EndianS16_BtoL

Converts a signed 16-bit big-endian value to the equivalent little-endian value.

EndianS32_BtoL

Converts a signed 32-bit big-endian value to the equivalent little-endian value.

EndianS64_BtoL

Converts a signed 64-bit big-endian value to the equivalent little-endian value.

EndianU16_BtoL

Converts an unsigned 16-bit big-endian value to the equivalent little-endian value.

EndianU32_BtoL

Converts an unsigned 32-bit big-endian value to the equivalent little-endian value.

EndianU64_BtoL

Converts an unsigned 64-bit big-endian value to the equivalent little-endian value.

Converting From Little-Endian to Big-Endian Format

EndianS16_LtoB

Converts a signed 16-bit little-endian value to the equivalent big-endian value.

EndianS32_LtoB

Converts a signed 32-bit little-endian value to the equivalent big-endian value.

EndianS64_LtoB

Converts a signed 64-bit little-endian value to the equivalent big-endian value.

EndianU16_LtoB

Converts an unsigned 16-bit little-endian value to the equivalent big-endian value.

EndianU32_LtoB

Converts an unsigned 32-bit little-endian value to the equivalent big-endian value.

EndianU64_LtoB

Converts an unsigned 64-bit little-endian value to the equivalent big-endian value.

Callbacks

CoreEndianFlipProc

Defines a pointer to a callback function that byte-swaps your custom data.

Data Types

BigEndianLong

Protects a big-endian long value from being changed by little-endian code.

BigEndianUnsignedLong

Protects a big-endian unsigned long value from being changed by little-endian code.

BigEndianShort

Protects a big-endian short value from being changed by little-endian code.

BigEndianUnsignedShort

Protects a big-endian unsigned short value from being changed by little-endian code.

BigEndianFixed

Protects a big-endian Fixed value from being changed by little-endian code.

BigEndianUnsignedFixed

Protects a big-endian unsigned Fixed value from being changed by little-endian code.

BigEndianOSType

Protects a big-endian OSType value from being changed by little-endian code.

Constants

Domain Types

Specify the domain to which a flipper callback should be applied.