123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768 |
- {
- File: CarbonCore/Endian.h
-
- Contains: Endian swapping utilties
-
- Version: CarbonCore-654.0.85~1
-
- Copyright: © 1997-2005 by Apple Computer, Inc., all rights reserved
-
- Bugs?: For bug reports, consult the following page on
- the World Wide Web:
-
- http://www.freepascal.org/bugs.html
-
- }
- { Pascal Translation Updated: Peter N Lewis, <[email protected]>, November 2005 }
- {
- Modified for use with Free Pascal
- Version 200
- Please report any bugs to <[email protected]>
- }
- {$mode macpas}
- {$packenum 1}
- {$macro on}
- {$inline on}
- {$CALLING MWPASCAL}
- unit Endian;
- interface
- {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
- {$setc GAP_INTERFACES_VERSION := $0200}
- {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
- {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
- {$endc}
- {$ifc defined CPUPOWERPC and defined CPUI386}
- {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
- {$endc}
- {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
- {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
- {$endc}
- {$ifc not defined __ppc__ and defined CPUPOWERPC}
- {$setc __ppc__ := 1}
- {$elsec}
- {$setc __ppc__ := 0}
- {$endc}
- {$ifc not defined __i386__ and defined CPUI386}
- {$setc __i386__ := 1}
- {$elsec}
- {$setc __i386__ := 0}
- {$endc}
- {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
- {$error Conflicting definitions for __ppc__ and __i386__}
- {$endc}
- {$ifc defined __ppc__ and __ppc__}
- {$setc TARGET_CPU_PPC := TRUE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$elifc defined __i386__ and __i386__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_X86 := TRUE}
- {$elsec}
- {$error Neither __ppc__ nor __i386__ is defined.}
- {$endc}
- {$setc TARGET_CPU_PPC_64 := FALSE}
- {$ifc defined FPC_BIG_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := TRUE}
- {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
- {$elifc defined FPC_LITTLE_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := FALSE}
- {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
- {$elsec}
- {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
- {$endc}
- {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
- {$setc CALL_NOT_IN_CARBON := FALSE}
- {$setc OLDROUTINENAMES := FALSE}
- {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
- {$setc OPAQUE_UPP_TYPES := TRUE}
- {$setc OTCARBONAPPLICATION := TRUE}
- {$setc OTKERNEL := FALSE}
- {$setc PM_USE_SESSION_APIS := TRUE}
- {$setc TARGET_API_MAC_CARBON := TRUE}
- {$setc TARGET_API_MAC_OS8 := FALSE}
- {$setc TARGET_API_MAC_OSX := TRUE}
- {$setc TARGET_CARBON := TRUE}
- {$setc TARGET_CPU_68K := FALSE}
- {$setc TARGET_CPU_MIPS := FALSE}
- {$setc TARGET_CPU_SPARC := FALSE}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_UNIX := FALSE}
- {$setc TARGET_OS_WIN32 := FALSE}
- {$setc TARGET_RT_MAC_68881 := FALSE}
- {$setc TARGET_RT_MAC_CFM := FALSE}
- {$setc TARGET_RT_MAC_MACHO := TRUE}
- {$setc TYPED_FUNCTION_POINTERS := TRUE}
- {$setc TYPE_BOOL := FALSE}
- {$setc TYPE_EXTENDED := FALSE}
- {$setc TYPE_LONGLONG := TRUE}
- uses MacTypes;
- {$ALIGN MAC68K}
- {
- 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
- <U> is whether the integer is signed ('S') or unsigned ('U')
- <W> is integer bit width: 16, 32, or 64
- <S> 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.
- For gcc, the macros build on top of the inline byte swapping
- routines from <libkern/OSByteOrder.h>, which may have better performance.
-
-
- <<< 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.
-
- }
- // Macros might be better solutions
- function Endian16_Swap( arg: UInt16 ): UInt16; inline;
- function Endian32_Swap( arg: UInt32 ): UInt32; inline;
- function Endian64_Swap_Pascal( arg: UInt64 ): UInt64; inline;
- function EndianS16_Swap( arg: SInt16 ): SInt16; inline;
- function EndianS32_Swap( arg: SInt32 ): SInt32; inline;
- function EndianS64_Swap( arg: SInt64 ): SInt64; inline;
- function Endian64_Swap( arg: UInt64 ): UInt64; inline;
- // Macro away no-op functions
- {$ifc TARGET_RT_BIG_ENDIAN}
- function EndianS16_BtoN( arg: SInt16 ): SInt16; inline;
- function EndianS16_NtoB( arg: SInt16 ): SInt16; inline;
- function EndianU16_BtoN( arg: UInt16 ): UInt16; inline;
- function EndianU16_NtoB( arg: UInt16 ): UInt16; inline;
- function EndianS32_BtoN( arg: SInt32 ): SInt32; inline;
- function EndianS32_NtoB( arg: SInt32 ): SInt32; inline;
- function EndianU32_BtoN( arg: UInt32 ): UInt32; inline;
- function EndianU32_NtoB( arg: UInt32 ): UInt32; inline;
- function EndianS64_BtoN( arg: SInt64 ): SInt64; inline;
- function EndianS64_NtoB( arg: SInt64 ): SInt64; inline;
- function EndianU64_BtoN( arg: UInt64 ): UInt64; inline;
- function EndianU64_NtoB( arg: UInt64 ): UInt64; inline;
- {$elsec}
- function EndianS16_LtoN( arg: SInt16 ): SInt16; inline;
- function EndianS16_NtoL( arg: SInt16 ): SInt16; inline;
- function EndianU16_LtoN( arg: UInt16 ): UInt16; inline;
- function EndianU16_NtoL( arg: UInt16 ): UInt16; inline;
- function EndianS32_LtoN( arg: SInt32 ): SInt32; inline;
- function EndianS32_NtoL( arg: SInt32 ): SInt32; inline;
- function EndianU32_LtoN( arg: UInt32 ): UInt32; inline;
- function EndianU32_NtoL( arg: UInt32 ): UInt32; inline;
- function EndianS64_LtoN( arg: SInt64 ): SInt64; inline;
- function EndianS64_NtoL( arg: SInt64 ): SInt64; inline;
- function EndianU64_LtoN( arg: UInt64 ): UInt64; inline;
- function EndianU64_NtoL( arg: UInt64 ): UInt64; inline;
- {$endc}
- // Map native to actual
- {$ifc TARGET_RT_BIG_ENDIAN}
- function EndianS16_LtoN( arg: SInt16 ): SInt16; inline;
- function EndianS16_NtoL( arg: SInt16 ): SInt16; inline;
- function EndianU16_LtoN( arg: UInt16 ): UInt16; inline;
- function EndianU16_NtoL( arg: UInt16 ): UInt16; inline;
- function EndianS32_LtoN( arg: SInt32 ): SInt32; inline;
- function EndianS32_NtoL( arg: SInt32 ): SInt32; inline;
- function EndianU32_LtoN( arg: UInt32 ): UInt32; inline;
- function EndianU32_NtoL( arg: UInt32 ): UInt32; inline;
- function EndianS64_LtoN( arg: SInt64 ): SInt64; inline;
- function EndianS64_NtoL( arg: SInt64 ): SInt64; inline;
- function EndianU64_LtoN( arg: UInt64 ): UInt64; inline;
- function EndianU64_NtoL( arg: UInt64 ): UInt64; inline;
- {$elsec}
- function EndianS16_BtoN( arg: SInt16 ): SInt16; inline;
- function EndianS16_NtoB( arg: SInt16 ): SInt16; inline;
- function EndianU16_BtoN( arg: UInt16 ): UInt16; inline;
- function EndianU16_NtoB( arg: UInt16 ): UInt16; inline;
- function EndianS32_BtoN( arg: SInt32 ): SInt32; inline;
- function EndianS32_NtoB( arg: SInt32 ): SInt32; inline;
- function EndianU32_BtoN( arg: UInt32 ): UInt32; inline;
- function EndianU32_NtoB( arg: UInt32 ): UInt32; inline;
- function EndianS64_BtoN( arg: SInt64 ): SInt64; inline;
- function EndianS64_NtoB( arg: SInt64 ): SInt64; inline;
- function EndianU64_BtoN( arg: UInt64 ): UInt64; inline;
- function EndianU64_NtoB( arg: UInt64 ): UInt64; inline;
- {$endc}
- // Implement *LtoB and *BtoL
- function EndianS16_LtoB( arg: SInt16 ): SInt16; inline;
- function EndianS16_BtoL( arg: SInt16 ): SInt16; inline;
- function EndianU16_LtoB( arg: UInt16 ): UInt16; inline;
- function EndianU16_BtoL( arg: UInt16 ): UInt16; inline;
- function EndianS32_LtoB( arg: SInt32 ): SInt32; inline;
- function EndianS32_BtoL( arg: SInt32 ): SInt32; inline;
- function EndianU32_LtoB( arg: UInt32 ): UInt32; inline;
- function EndianU32_BtoL( arg: UInt32 ): UInt32; inline;
- function EndianS64_LtoB( arg: SInt64 ): SInt64; inline;
- function EndianS64_BtoL( arg: SInt64 ): SInt64; inline;
- function EndianU64_LtoB( arg: UInt64 ): UInt64; inline;
- function EndianU64_BtoL( arg: UInt64 ): UInt64; inline;
- {
- 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.
- }
- {$ifc TARGET_RT_LITTLE_ENDIAN}
- type
- BigEndianLong = record
- bigEndianValue: SInt32;
- end;
- BigEndianUnsignedLong = record
- bigEndianValue: UInt32;
- end;
- BigEndianShort = record
- bigEndianValue: SInt16;
- end;
- BigEndianUnsignedShort = record
- bigEndianValue: UInt16;
- end;
- BigEndianFixed = record
- bigEndianValue: Fixed;
- end;
- BigEndianUnsignedFixed = record
- bigEndianValue: UnsignedFixed;
- end;
- BigEndianOSType = record
- bigEndianValue: OSType;
- end;
- {$elsec}
- type
- BigEndianLong = SInt32;
- BigEndianUnsignedLong = UInt32;
- BigEndianShort = SInt16;
- BigEndianUnsignedShort = UInt16;
- BigEndianFixed = Fixed;
- BigEndianUnsignedFixed = UnsignedFixed;
- BigEndianOSType = OSType;
- {$endc} {TARGET_RT_LITTLE_ENDIAN}
- type
- BigEndianLongPtr = ^BigEndianLong;
- BigEndianUnsignedLongPtr = ^BigEndianUnsignedLong;
- BigEndianShortPtr = ^BigEndianShort;
- BigEndianUnsignedShortPtr = ^BigEndianUnsignedShort;
- BigEndianFixedPtr = ^BigEndianFixed;
- BigEndianUnsignedFixedPtr = ^BigEndianUnsignedFixed;
- BigEndianOSTypePtr = ^BigEndianOSType;
- {
- CoreEndian flipping API.
- This API is used to generically massage data buffers, in
- place, from one endian architecture to another. In effect,
- the API supports registering a set of callbacks that can
- effect this translation.
- The data types have specific meanings within their domain,
- although some data types can be registered with the same
- callback in several domains. There is no wildcard domain.
- A set of pre-defined flippers are implemented by the Carbon
- frameworks for most common resource manager and AppleEvent data
- types.
- }
- const
- kCoreEndianResourceManagerDomain = $72737263 (* 'rsrc' *);
- kCoreEndianAppleEventManagerDomain = $61657674 (* 'aevt' *);
- {
- * CoreEndianFlipProc
- *
- * Discussion:
- * Callback use to flip endian-ness of typed data
- *
- * Parameters:
- *
- * dataDomain:
- * Domain of the data type
- *
- * dataType:
- * Type of data being flipped
- *
- * id:
- * resource id (if being flipped on behalf of the resource
- * manager, otherwise will be zero)
- *
- * dataPtr:
- * Pointer to the data
- *
- * dataSize:
- * Length of the data
- *
- * currentlyNative:
- * Boolean indicating which direction to flip: false means flip
- * from disk big endian to native (from disk), true means flip
- * from native to disk big endian (to disk)
- *
- * refcon:
- * An optional user reference supplied when the flipper is
- * installed
- *
- * Result:
- * Error code indicating whether the data was flipped. noErr would
- * indicate that the data was flipped as appropriate; any other
- * error will be propagated back to the caller.
- }
- type
- CoreEndianFlipProc = function( dataDomain: OSType; dataType: OSType; id: SInt16; dataPtr: UnivPtr; dataSize: UInt32; currentlyNative: Boolean; refcon: UnivPtr ): OSStatus;
- {
- * Install a flipper for this application
- }
- {
- * CoreEndianInstallFlipper()
- *
- * Summary:
- * Installs a flipper proc for the given data type. If the flipper
- * is already registered, this flipper will take replace it.
- *
- * Mac OS X threading:
- * Thread safe since version 10.3
- *
- * Parameters:
- *
- * dataDomain:
- * Domain of the data type
- *
- * dataType:
- * Type of data for which this flipper should be installed
- *
- * proc:
- * Flipper callback to be called for data of this type
- *
- * refcon:
- * Optional user reference for the flipper
- *
- * Result:
- * Error code indicating whether or not the flipper could be
- * installed
- *
- * Availability:
- * Mac OS X: in version 10.3 and later in CoreServices.framework
- * CarbonLib: not available
- * Non-Carbon CFM: not available
- }
- function CoreEndianInstallFlipper( dataDomain: OSType; dataType: OSType; proc: CoreEndianFlipProc; refcon: UnivPtr { can be NULL } ): OSStatus; external name '_CoreEndianInstallFlipper';
- (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
- {
- * CoreEndianGetFlipper()
- *
- * Summary:
- * Gets an existing data flipper proc for the given data type
- *
- * Mac OS X threading:
- * Thread safe since version 10.3
- *
- * Parameters:
- *
- * dataDomain:
- * Domain of the data type
- *
- * dataType:
- * Type of the data for which this flipper should be installed
- *
- * proc:
- * Pointer to a flipper callback
- *
- * refcon:
- * Pointer to the callback refcon
- *
- * Result:
- * noErr if the given flipper could be found; otherwise
- * handlerNotFoundErr will be returned.
- *
- * Availability:
- * Mac OS X: in version 10.3 and later in CoreServices.framework
- * CarbonLib: not available
- * Non-Carbon CFM: not available
- }
- function CoreEndianGetFlipper( dataDomain: OSType; dataType: OSType; var proc: CoreEndianFlipProc; refcon: UnivPtrPtr ): OSStatus; external name '_CoreEndianGetFlipper';
- (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
- {
- * CoreEndianFlipData()
- *
- * Summary:
- * Calls the flipper for the given data type with the associated data
- *
- * Mac OS X threading:
- * Thread safe since version 10.3
- *
- * Parameters:
- *
- * dataDomain:
- * Domain of the data type
- *
- * dataType:
- * type of the data
- *
- * id:
- * resource id (if not a resource, pass zero)
- *
- * data:
- * a pointer to the data to be flipped (in place)
- *
- * dataLen:
- * length of the data to flip
- *
- * currentlyNative:
- * a boolean indicating the direction to flip (whether the data is
- * currently native endian or big-endian)
- *
- * Result:
- * Error code indicating whether the data was flipped. If
- * handlerNotFound is returned, then no flipping took place (which
- * is not necessarily an error condtion)
- *
- * Availability:
- * Mac OS X: in version 10.3 and later in CoreServices.framework
- * CarbonLib: not available
- * Non-Carbon CFM: not available
- }
- function CoreEndianFlipData( dataDomain: OSType; dataType: OSType; id: SInt16; data: UnivPtr; dataLen: UInt32; currentlyNative: Boolean ): OSStatus; external name '_CoreEndianFlipData';
- (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
- implementation
- {$R-}
- function Endian16_Swap( arg: UInt16 ): UInt16; inline;
- begin
- Endian16_Swap := (( arg shl 8) and $0FF00) or (( arg shr 8) and $00FF);
- end;
- function Endian32_Swap( arg: UInt32 ): UInt32; inline;
- begin
- Endian32_Swap := ((arg and $FF) shl 24) or ((arg and $0FF00) shl 8) or ((arg shr 8) and $0FF00) or ((arg shr 24) and $FF);
- end;
- function Endian64_Swap_Pascal( arg: UInt64 ): UInt64; inline;
- begin
- Endian64_Swap_Pascal := (Endian32_Swap( arg and $FFFFFFFF ) shl 32) or Endian32_Swap( (arg shr 32) and $FFFFFFFF );
- end;
- function Endian64_Swap( arg: UInt64 ): UInt64; inline;
- begin
- Endian64_Swap := Endian64_Swap_Pascal(arg);
- end;
- function EndianS16_Swap( arg: SInt16 ): SInt16; inline;
- begin
- EndianS16_Swap := (( arg shl 8) and $0FF00) or (( arg shr 8) and $00FF);
- end;
- function EndianS32_Swap( arg: SInt32 ): SInt32; inline;
- begin
- EndianS32_Swap := ((arg and $FF) shl 24) or ((arg and $0FF00) shl 8) or ((arg shr 8) and $0FF00) or ((arg shr 24) and $FF);
- end;
- function EndianS64_Swap( arg: SInt64 ): SInt64; inline;
- begin
- EndianS64_Swap := (Endian32_Swap( arg and $FFFFFFFF ) shl 32) or Endian32_Swap( (arg shr 32) and $FFFFFFFF );
- end;
- {$ifc TARGET_RT_BIG_ENDIAN}
- function EndianS16_BtoN( arg: SInt16 ): SInt16; inline;
- begin
- EndianS16_BtoN := arg;
- end;
- function EndianS16_NtoB( arg: SInt16 ): SInt16; inline;
- begin
- EndianS16_NtoB := arg;
- end;
- function EndianU16_BtoN( arg: UInt16 ): UInt16; inline;
- begin
- EndianU16_BtoN := arg;
- end;
- function EndianU16_NtoB( arg: UInt16 ): UInt16; inline;
- begin
- EndianU16_NtoB := arg;
- end;
- function EndianS32_BtoN( arg: SInt32 ): SInt32; inline;
- begin
- EndianS32_BtoN := arg;
- end;
- function EndianS32_NtoB( arg: SInt32 ): SInt32; inline;
- begin
- EndianS32_NtoB := arg;
- end;
- function EndianU32_BtoN( arg: UInt32 ): UInt32; inline;
- begin
- EndianU32_BtoN := arg;
- end;
- function EndianU32_NtoB( arg: UInt32 ): UInt32; inline;
- begin
- EndianU32_NtoB := arg;
- end;
- function EndianS64_BtoN( arg: SInt64 ): SInt64; inline;
- begin
- EndianS64_BtoN := arg;
- end;
- function EndianS64_NtoB( arg: SInt64 ): SInt64; inline;
- begin
- EndianS64_NtoB := arg;
- end;
- function EndianU64_BtoN( arg: UInt64 ): UInt64; inline;
- begin
- EndianU64_BtoN := arg;
- end;
- function EndianU64_NtoB( arg: UInt64 ): UInt64; inline;
- begin
- EndianU64_NtoB := arg;
- end;
- function EndianS16_LtoN( arg: SInt16 ): SInt16; inline;
- begin
- EndianS16_LtoN := EndianS16_Swap(arg);
- end;
- function EndianS16_NtoL( arg: SInt16 ): SInt16; inline;
- begin
- EndianS16_NtoL := EndianS16_Swap(arg);
- end;
- function EndianU16_LtoN( arg: UInt16 ): UInt16; inline;
- begin
- EndianU16_LtoN := Endian16_Swap(arg);
- end;
- function EndianU16_NtoL( arg: UInt16 ): UInt16; inline;
- begin
- EndianU16_NtoL := Endian16_Swap(arg);
- end;
- function EndianS32_LtoN( arg: SInt32 ): SInt32; inline;
- begin
- EndianS32_LtoN := EndianS32_Swap(arg);
- end;
- function EndianS32_NtoL( arg: SInt32 ): SInt32; inline;
- begin
- EndianS32_NtoL := EndianS32_Swap(arg);
- end;
- function EndianU32_LtoN( arg: UInt32 ): UInt32; inline;
- begin
- EndianU32_LtoN := Endian32_Swap(arg);
- end;
- function EndianU32_NtoL( arg: UInt32 ): UInt32; inline;
- begin
- EndianU32_NtoL := Endian32_Swap(arg);
- end;
- function EndianS64_LtoN( arg: SInt64 ): SInt64; inline;
- begin
- EndianS64_LtoN := EndianS64_Swap(arg);
- end;
- function EndianS64_NtoL( arg: SInt64 ): SInt64; inline;
- begin
- EndianS64_NtoL := EndianS64_Swap(arg);
- end;
- function EndianU64_LtoN( arg: UInt64 ): UInt64; inline;
- begin
- EndianU64_LtoN := Endian64_Swap(arg);
- end;
- function EndianU64_NtoL( arg: UInt64 ): UInt64; inline;
- begin
- EndianU64_NtoL := Endian64_Swap(arg);
- end;
- {$elsec}
- function EndianS16_BtoN( arg: SInt16 ): SInt16; inline;
- begin
- EndianS16_BtoN := EndianS16_Swap(arg);
- end;
- function EndianS16_NtoB( arg: SInt16 ): SInt16; inline;
- begin
- EndianS16_NtoB := EndianS16_Swap(arg);
- end;
- function EndianU16_BtoN( arg: UInt16 ): UInt16; inline;
- begin
- EndianU16_BtoN := Endian16_Swap(arg);
- end;
- function EndianU16_NtoB( arg: UInt16 ): UInt16; inline;
- begin
- EndianU16_NtoB := Endian16_Swap(arg);
- end;
- function EndianS32_BtoN( arg: SInt32 ): SInt32; inline;
- begin
- EndianS32_BtoN := EndianS32_Swap(arg);
- end;
- function EndianS32_NtoB( arg: SInt32 ): SInt32; inline;
- begin
- EndianS32_NtoB := EndianS32_Swap(arg);
- end;
- function EndianU32_BtoN( arg: UInt32 ): UInt32; inline;
- begin
- EndianU32_BtoN := Endian32_Swap(arg);
- end;
- function EndianU32_NtoB( arg: UInt32 ): UInt32; inline;
- begin
- EndianU32_NtoB := Endian32_Swap(arg);
- end;
- function EndianS64_BtoN( arg: SInt64 ): SInt64; inline;
- begin
- EndianS64_BtoN := EndianS64_Swap(arg);
- end;
- function EndianS64_NtoB( arg: SInt64 ): SInt64; inline;
- begin
- EndianS64_NtoB := EndianS64_Swap(arg);
- end;
- function EndianU64_BtoN( arg: UInt64 ): UInt64; inline;
- begin
- EndianU64_BtoN := Endian64_Swap(arg);
- end;
- function EndianU64_NtoB( arg: UInt64 ): UInt64; inline;
- begin
- EndianU64_NtoB := Endian64_Swap(arg);
- end;
- function EndianS16_LtoN( arg: SInt16 ): SInt16; inline;
- begin
- EndianS16_LtoN := arg;
- end;
- function EndianS16_NtoL( arg: SInt16 ): SInt16; inline;
- begin
- EndianS16_NtoL := arg;
- end;
- function EndianU16_LtoN( arg: UInt16 ): UInt16; inline;
- begin
- EndianU16_LtoN := arg;
- end;
- function EndianU16_NtoL( arg: UInt16 ): UInt16; inline;
- begin
- EndianU16_NtoL := arg;
- end;
- function EndianS32_LtoN( arg: SInt32 ): SInt32; inline;
- begin
- EndianS32_LtoN := arg;
- end;
- function EndianS32_NtoL( arg: SInt32 ): SInt32; inline;
- begin
- EndianS32_NtoL := arg;
- end;
- function EndianU32_LtoN( arg: UInt32 ): UInt32; inline;
- begin
- EndianU32_LtoN := arg;
- end;
- function EndianU32_NtoL( arg: UInt32 ): UInt32; inline;
- begin
- EndianU32_NtoL := arg;
- end;
- function EndianS64_LtoN( arg: SInt64 ): SInt64; inline;
- begin
- EndianS64_LtoN := arg;
- end;
- function EndianS64_NtoL( arg: SInt64 ): SInt64; inline;
- begin
- EndianS64_NtoL := arg;
- end;
- function EndianU64_LtoN( arg: UInt64 ): UInt64; inline;
- begin
- EndianU64_LtoN := arg;
- end;
- function EndianU64_NtoL( arg: UInt64 ): UInt64; inline;
- begin
- EndianU64_NtoL := arg;
- end;
- {$endc}
- end.
|