es40_endian.h File Reference


Detailed Description

Contains macro's for byte-swapping on big-endian host architectures.

Id
es40_endian.h,v 1.7 2008/03/14 15:30:52 iamcamiel Exp

X-1.6 Camiel Vanderhoeven 14-MAR-2008 1. More meaningful exceptions replace throwing (int) 1. 2. U64 macro replaces X64 macro.

X-1.5 Camiel Vanderhoeven 04-JAN-2008 Added swap_xx macro's for use in places where bytes need to be swapped regardless of endianess.

X-1.4 Camiel Vanderhoeven 03-JAN-2008 Attempt to make PCI base device endianess-correct.

X-1.3 Fang Zhe 02-JAN-2008 Recognize endianess on more architectures.

X-1.2 Camiel Vanderhoeven 30-MAR-2007 Added old changelog comments.

X-1.1 Brian Wheeler 8-MAR-2007 Renamed this file from endian.h to es40_endian.h to avoid conflicts with system-include files.

X-A1-1.2 Camiel Vanderhoeven 7-MAR-2007 Properly handle OpenVMS

X-A1-1.1 Camiel Vanderhoeven 1-MAR-2007 File created to support the Solaris/SPARC port.

Author:
Camiel Vanderhoeven (camiel@camicom.com / http://www.camicom.com)

Definition in file es40_endian.h.

Go to the source code of this file.

Defines

#define INCLUDED_ENDIAN_H
#define ES40_LITTLE_ENDIAN
#define swap_64(x)
#define swap_32(x)
#define swap_16(x)   ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8))
#define swap_8(x)   ((x) & 0xff)
#define endian_64(x)   (x)
#define endian_32(x)   ((x) & 0xffffffff)
#define endian_16(x)   ((x) & 0xffff)
#define endian_8(x)   ((x) & 0xff)

Functions

u64 endian_bits (u64 x, int numbits)


Define Documentation

#define endian_16 (  )     ((x) & 0xffff)

#define endian_32 (  )     ((x) & 0xffffffff)

#define endian_64 (  )     (x)

Definition at line 110 of file es40_endian.h.

Referenced by endian_bits(), CSystem::LoadROM(), CSystem::ReadMem(), and CSystem::WriteMem().

#define endian_8 (  )     ((x) & 0xff)

#define ES40_LITTLE_ENDIAN

Definition at line 66 of file es40_endian.h.

#define INCLUDED_ENDIAN_H

Definition at line 62 of file es40_endian.h.

#define swap_16 (  )     ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8))

Definition at line 102 of file es40_endian.h.

#define swap_32 (  ) 

Value:

(                                                          \
      (((x) & 0x000000ff) << 24) | (((x) & 0x0000ff00) << 8) | \
        (((x) & 0x00ff0000) >> 8) | (((x) & 0xff000000) >> 24) \
    )

Definition at line 97 of file es40_endian.h.

#define swap_64 (  ) 

Value:

(                                                       \
      (((x) & U64(0x00000000000000ff)) << 56) |             \
        (((x) & U64(0x000000000000ff00)) << 40) |           \
          (((x) & U64(0x0000000000ff0000)) << 24) |         \
            (((x) & U64(0x00000000ff000000)) << 8) |        \
              (((x) & U64(0x000000ff00000000)) >> 8) |      \
                (((x) & U64(0x0000ff0000000000)) >> 24) |   \
                  (((x) & U64(0x00ff000000000000)) >> 40) | \
                    (((x) & U64(0xff00000000000000)) >> 56) \
    )

Definition at line 86 of file es40_endian.h.

#define swap_8 (  )     ((x) & 0xff)

Definition at line 103 of file es40_endian.h.


Function Documentation

u64 endian_bits ( u64  x,
int  numbits 
) [inline]

Definition at line 115 of file es40_endian.h.

References endian_16, endian_32, endian_64, endian_8, and FAILURE.

Referenced by CDEC21143::WriteMem_Bar().


SourceForge.net Logo
Project space on SourceForge.net