Mac OS 9
Endian.h File Reference

QuickTime Interfaces. More...

#include <ConditionalMacros.h>
#include <MacTypes.h>

Go to the source code of this file.

Macros

#define EndianS16_LtoN(value)   (value)
 
#define EndianS16_NtoL(value)   (value)
 
#define EndianU16_LtoN(value)   (value)
 
#define EndianU16_NtoL(value)   (value)
 
#define EndianS32_LtoN(value)   (value)
 
#define EndianS32_NtoL(value)   (value)
 
#define EndianU32_LtoN(value)   (value)
 
#define EndianU32_NtoL(value)   (value)
 
#define EndianS64_LtoN(value)   (value)
 
#define EndianS64_NtoL(value)   (value)
 
#define EndianU64_LtoN(value)   (value)
 
#define EndianU64_NtoL(value)   (value)
 
#define EndianS16_BtoN(value)   EndianS16_BtoL(value)
 
#define EndianS16_NtoB(value)   EndianS16_LtoB(value)
 
#define EndianU16_BtoN(value)   EndianU16_BtoL(value)
 
#define EndianU16_NtoB(value)   EndianU16_LtoB(value)
 
#define EndianS32_BtoN(value)   EndianS32_BtoL(value)
 
#define EndianS32_NtoB(value)   EndianS32_LtoB(value)
 
#define EndianU32_BtoN(value)   EndianU32_BtoL(value)
 
#define EndianU32_NtoB(value)   EndianU32_LtoB(value)
 
#define EndianS64_BtoN(value)   EndianS64_BtoL(value)
 
#define EndianS64_NtoB(value)   EndianS64_LtoB(value)
 
#define EndianU64_BtoN(value)   EndianU64_BtoL(value)
 
#define EndianU64_NtoB(value)   EndianU64_LtoB(value)
 
#define EndianS16_LtoB(value)   ((SInt16)Endian16_Swap(value))
 
#define EndianS16_BtoL(value)   ((SInt16)Endian16_Swap(value))
 
#define EndianU16_LtoB(value)   ((UInt16)Endian16_Swap(value))
 
#define EndianU16_BtoL(value)   ((UInt16)Endian16_Swap(value))
 
#define EndianS32_LtoB(value)   ((SInt32)Endian32_Swap(value))
 
#define EndianS32_BtoL(value)   ((SInt32)Endian32_Swap(value))
 
#define EndianU32_LtoB(value)   ((UInt32)Endian32_Swap(value))
 
#define EndianU32_BtoL(value)   ((UInt32)Endian32_Swap(value))
 
#define EndianS64_LtoB(value)   ((SInt64)Endian64_Swap((UInt64)value))
 
#define EndianS64_BtoL(value)   ((SInt64)Endian64_Swap((UInt64)value))
 
#define EndianU64_LtoB(value)   ((UInt64)Endian64_Swap(value))
 
#define EndianU64_BtoL(value)   ((UInt64)Endian64_Swap(value))
 
#define Endian16_Swap(value)    (((((UInt16)value) << 8) & 0xFF00) | ((((UInt16)value) >> 8) & 0x00FF))
 
#define Endian32_Swap(value)
 

Typedefs

typedef long BigEndianLong
 
typedef unsigned long BigEndianUnsignedLong
 
typedef short BigEndianShort
 
typedef unsigned short BigEndianUnsignedShort
 
typedef Fixed BigEndianFixed
 
typedef UnsignedFixed BigEndianUnsignedFixed
 
typedef OSType BigEndianOSType
 

Functions

SInt16 EndianS16_BtoN (SInt16 value)
 
SInt16 EndianS16_NtoB (SInt16 value)
 
SInt16 EndianS16_LtoN (SInt16 value)
 
SInt16 EndianS16_NtoL (SInt16 value)
 
SInt16 EndianS16_LtoB (SInt16 value)
 
SInt16 EndianS16_BtoL (SInt16 value)
 
UInt16 EndianU16_BtoN (UInt16 value)
 
UInt16 EndianU16_NtoB (UInt16 value)
 
UInt16 EndianU16_LtoN (UInt16 value)
 
UInt16 EndianU16_NtoL (UInt16 value)
 
UInt16 EndianU16_LtoB (UInt16 value)
 
UInt16 EndianU16_BtoL (UInt16 value)
 
SInt32 EndianS32_BtoN (SInt32 value)
 
SInt32 EndianS32_NtoB (SInt32 value)
 
SInt32 EndianS32_LtoN (SInt32 value)
 
SInt32 EndianS32_NtoL (SInt32 value)
 
SInt32 EndianS32_LtoB (SInt32 value)
 
SInt32 EndianS32_BtoL (SInt32 value)
 
UInt32 EndianU32_BtoN (UInt32 value)
 
UInt32 EndianU32_NtoB (UInt32 value)
 
UInt32 EndianU32_LtoN (UInt32 value)
 
UInt32 EndianU32_NtoL (UInt32 value)
 
UInt32 EndianU32_LtoB (UInt32 value)
 
UInt32 EndianU32_BtoL (UInt32 value)
 
SInt64 EndianS64_BtoN (SInt64 value)
 
SInt64 EndianS64_NtoB (SInt64 value)
 
SInt64 EndianS64_LtoN (SInt64 value)
 
SInt64 EndianS64_NtoL (SInt64 value)
 
SInt64 EndianS64_LtoB (SInt64 value)
 
SInt64 EndianS64_BtoL (SInt64 value)
 
UInt64 EndianU64_BtoN (UInt64 value)
 
UInt64 EndianU64_NtoB (UInt64 value)
 
UInt64 EndianU64_LtoN (UInt64 value)
 
UInt64 EndianU64_NtoL (UInt64 value)
 
UInt64 EndianU64_LtoB (UInt64 value)
 
UInt64 EndianU64_BtoL (UInt64 value)
 
UInt16 Endian16_Swap (UInt16 value)
 
UInt32 Endian32_Swap (UInt32 value)
 
UInt64 Endian64_Swap (UInt64 value)
 

Detailed Description

QuickTime Interfaces.

Introduced In: QuickTime 3.0
Avaliable From: Universal Interfaces 3.4.1
Copyright: © 1997-2001 by Apple Computer, Inc., all rights reserved

Macro Definition Documentation

◆ Endian16_Swap

#define Endian16_Swap (   value)     (((((UInt16)value) << 8) & 0xFF00) | ((((UInt16)value) >> 8) & 0x00FF))

CALL_NOT_IN_CARBON override with macros

◆ Endian32_Swap

#define Endian32_Swap (   value)
Value:
(((((UInt32)value) << 24) & 0xFF000000) | \
((((UInt32)value) << 8) & 0x00FF0000) | \
((((UInt32)value) >> 8) & 0x0000FF00) | \
((((UInt32)value) >> 24) & 0x000000FF))

◆ EndianS16_BtoN

#define EndianS16_BtoN (   value)    EndianS16_BtoL(value)

Map native to actual

◆ EndianS16_LtoB

#define EndianS16_LtoB (   value)    ((SInt16)Endian16_Swap(value))

Implement ©LtoB and ©BtoL

◆ EndianS16_LtoN

#define EndianS16_LtoN (   value)    (value)

TARGET_RT_LITTLE_ENDIAN Macro away no-op functions

Typedef Documentation

◆ BigEndianLong

typedef long BigEndianLong

CALL_NOT_IN_CARBON !TYPE_LONGLONG These types are used for structures that contain data that is always in BigEndian format. This extra typing prevents little endian code from directly changing the data, thus saving much time in the debugger.

Function Documentation

◆ Endian16_Swap()

UInt16 Endian16_Swap ( UInt16  value)

Implement low level ©_Swap functions.

extern UInt16 Endian16_Swap(UInt16 value);
extern UInt32 Endian32_Swap(UInt32 value);
extern UInt64 Endian64_Swap(UInt64 value);

Note: Depending on the processor, you might want to implement these as function calls instead of macros. Endian16_Swap()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ Endian32_Swap()

UInt32 Endian32_Swap ( UInt32  value)

Endian32_Swap()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ Endian64_Swap()

UInt64 Endian64_Swap ( UInt64  value)

Note: When using compilers that don't support "long long", Endian64_Swap must be implemented as glue. Endian64_Swap()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS16_BtoL()

SInt16 EndianS16_BtoL ( SInt16  value)

EndianS16_BtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS16_BtoN()

SInt16 EndianS16_BtoN ( SInt16  value)

This file provides Endian Flipping routines for dealing with converting data between Big-Endian and Little-Endian machines. These routines are useful when writing code to compile for both Big and Little Endian machines and which must handle other endian number formats, such as reading or writing to a file or network packet.

These routines are named as follows:

Endian<U><W>_<S>to<D>

where is whether the integer is signed ('S') or unsigned ('U') <W> is integer bit width: 16, 32, or 64 is the source endian format: 'B' for big, 'L' for little, or 'N' for native <D> is the destination endian format: 'B' for big, 'L' for little, or 'N' for native

For example, to convert a Big Endian 32-bit unsigned integer to the current native format use:

 long i = EndianU32_BtoN(data);

This file is set up so that the function macro to nothing when the target runtime already is the desired format (e.g. on Big Endian machines, EndianU32_BtoN() macros away).

If long long's are not supported, you cannot get 64-bit quantities as a single value. The macros are not defined in that case.

                         <<< W A R N I N G >>>

It is very important not to put any autoincrements inside the macros. This will produce erroneous results because each time the address is accessed in the macro, the increment occurs. Note: These functions are currently not implemented in any library and are only listed here as function prototypes to document the macros EndianS16_BtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS16_LtoB()

SInt16 EndianS16_LtoB ( SInt16  value)

EndianS16_LtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS16_LtoN()

SInt16 EndianS16_LtoN ( SInt16  value)

EndianS16_LtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS16_NtoB()

SInt16 EndianS16_NtoB ( SInt16  value)

EndianS16_NtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS16_NtoL()

SInt16 EndianS16_NtoL ( SInt16  value)

EndianS16_NtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS32_BtoL()

SInt32 EndianS32_BtoL ( SInt32  value)

EndianS32_BtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS32_BtoN()

SInt32 EndianS32_BtoN ( SInt32  value)

EndianS32_BtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS32_LtoB()

SInt32 EndianS32_LtoB ( SInt32  value)

EndianS32_LtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS32_LtoN()

SInt32 EndianS32_LtoN ( SInt32  value)

EndianS32_LtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS32_NtoB()

SInt32 EndianS32_NtoB ( SInt32  value)

EndianS32_NtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS32_NtoL()

SInt32 EndianS32_NtoL ( SInt32  value)

EndianS32_NtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS64_BtoL()

SInt64 EndianS64_BtoL ( SInt64  value)

EndianS64_BtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS64_BtoN()

SInt64 EndianS64_BtoN ( SInt64  value)

CALL_NOT_IN_CARBON Note: If these Int64 functions ever were implemented in a library, we would need two libraries, one for compilers that support long long and one for other compilers. EndianS64_BtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS64_LtoB()

SInt64 EndianS64_LtoB ( SInt64  value)

EndianS64_LtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS64_LtoN()

SInt64 EndianS64_LtoN ( SInt64  value)

EndianS64_LtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS64_NtoB()

SInt64 EndianS64_NtoB ( SInt64  value)

EndianS64_NtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianS64_NtoL()

SInt64 EndianS64_NtoL ( SInt64  value)

EndianS64_NtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU16_BtoL()

UInt16 EndianU16_BtoL ( UInt16  value)

EndianU16_BtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU16_BtoN()

UInt16 EndianU16_BtoN ( UInt16  value)

EndianU16_BtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU16_LtoB()

UInt16 EndianU16_LtoB ( UInt16  value)

EndianU16_LtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU16_LtoN()

UInt16 EndianU16_LtoN ( UInt16  value)

EndianU16_LtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU16_NtoB()

UInt16 EndianU16_NtoB ( UInt16  value)

EndianU16_NtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU16_NtoL()

UInt16 EndianU16_NtoL ( UInt16  value)

EndianU16_NtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU32_BtoL()

UInt32 EndianU32_BtoL ( UInt32  value)

EndianU32_BtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU32_BtoN()

UInt32 EndianU32_BtoN ( UInt32  value)

EndianU32_BtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU32_LtoB()

UInt32 EndianU32_LtoB ( UInt32  value)

EndianU32_LtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU32_LtoN()

UInt32 EndianU32_LtoN ( UInt32  value)

EndianU32_LtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU32_NtoB()

UInt32 EndianU32_NtoB ( UInt32  value)

EndianU32_NtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU32_NtoL()

UInt32 EndianU32_NtoL ( UInt32  value)

EndianU32_NtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU64_BtoL()

UInt64 EndianU64_BtoL ( UInt64  value)

EndianU64_BtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU64_BtoN()

UInt64 EndianU64_BtoN ( UInt64  value)

EndianU64_BtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU64_LtoB()

UInt64 EndianU64_LtoB ( UInt64  value)

EndianU64_LtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU64_LtoN()

UInt64 EndianU64_LtoN ( UInt64  value)

EndianU64_LtoN()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU64_NtoB()

UInt64 EndianU64_NtoB ( UInt64  value)

EndianU64_NtoB()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available

◆ EndianU64_NtoL()

UInt64 EndianU64_NtoL ( UInt64  value)

EndianU64_NtoL()

Non-Carbon CFM: not available
Carbon Lib: not available
Mac OS X: not available