-
Notifications
You must be signed in to change notification settings - Fork 0
/
byte_swap.h
45 lines (39 loc) · 1.96 KB
/
byte_swap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef __BYTE_SWAP_H__
#define __BYTE_SWAP_H__
#include "rom.h"
#include "os_structs.h"
extern void H2P_MemChunk (MemChunkHeaderUnionType* pChunk,
UInt16 version);
extern void P2H_MemChunk (MemChunkHeaderUnionType* pChunk,
UInt16 version);
extern void H2P_HeapHeader (MemHeapHeaderUnionType* pHeader);
extern void P2H_HeapHeader (MemHeapHeaderUnionType* pHeader);
extern void H2P_CardHeader (CardHeaderPtr pCard);
extern void P2H_CardHeader (CardHeaderPtr pCard);
extern void H2P_StorageHeader (StorageHeaderPtr pStore);
extern void P2H_StorageHeader (StorageHeaderPtr pStore);
extern void H2P_HeapList (HeapListPtr pHeapList);
extern void P2H_HeapList (HeapListPtr pHeapList);
extern void H2P_DatabaseList (DatabaseListPtr pDatabaseList);
extern void P2H_DatabaseList (DatabaseListPtr pDatabaseList);
extern void H2P_DatabaseHdr (DatabaseHdrPtr pDatabase);
extern void P2H_DatabaseHdr (DatabaseHdrPtr pDatabase);
extern void H2P_OverlaySpec (OmOverlaySpecType* pOvly);
extern void P2H_OverlaySpec (OmOverlaySpecType* pOvly);
/******************************************************************************
******************************************************************************
*** From <emulator>/SrcShared/ByteSwapping.h
******************************************************************************
******************************************************************************/
#if CPU_ENDIAN == CPU_ENDIAN_LITTLE
# define BYTE_SWAP_16(n) ((((unsigned short) (n) & 0x0000FF00) >> 8) | \
(((unsigned short) (n) & 0x000000FF) << 8))
# define BYTE_SWAP_32(n) ( (((unsigned long) (n)) << 24) | \
((((unsigned long) (n)) << 8) & 0x00FF0000) | \
((((unsigned long) (n)) >> 8) & 0x0000FF00) | \
(((unsigned long) (n)) >> 24))
#elif CPU_ENDIAN == CPU_ENDIAN_BIG
# define BYTE_SWAP_16(n) (n)
# define BYTE_SWAP_32(n) (n)
#endif // CPU_ENDIAN
#endif // __BYTE_SWAP_H__