undo bxswap change - it breaks build with bx_debugger enabled. error - multiple definition of bx_swap16 in parser.o and lexer.o

This commit is contained in:
Stanislav Shwartsman 2011-12-28 22:43:18 +00:00
parent 7cd72d6f79
commit 644c7c6289
3 changed files with 30 additions and 26 deletions

View File

@ -491,6 +491,32 @@ void bx_center_print(FILE *file, const char *line, unsigned maxwidth);
#include "instrument.h"
BX_CPP_INLINE Bit16u bx_bswap16(Bit16u val16)
{
return (val16<<8) | (val16>>8);
}
#if BX_HAVE___BUILTIN_BSWAP32
#define bx_bswap32 __builtin_bswap32
#else
BX_CPP_INLINE Bit32u bx_bswap32(Bit32u val32)
{
val32 = ((val32<<8) & 0xFF00FF00) | ((val32>>8) & 0x00FF00FF);
return (val32<<16) | (val32>>16);
}
#endif
#if BX_HAVE___BUILTIN_BSWAP64
#define bx_bswap64 __builtin_bswap64
#else
BX_CPP_INLINE Bit64u bx_bswap64(Bit64u val64)
{
Bit32u lo = bx_bswap32((Bit32u)(val64 >> 32));
Bit32u hi = bx_bswap32((Bit32u)(val64 & 0xFFFFFFFF));
return ((Bit64u)hi << 32) | (Bit64u)lo;
}
#endif
// These are some convenience macros which abstract out accesses between
// a variable in native byte ordering to/from guest (x86) memory, which is
// always in little endian format. You must deal with alignment (if your

View File

@ -18,6 +18,8 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifndef BX_DEBUG_H
#define BX_DEBUG_H
// if including from C parser, need basic types etc
#include "config.h"
@ -504,3 +506,5 @@ void bx_dbg_disassemble_current(int which_cpu, int print_time);
#endif // #ifdef __cplusplus
#endif // #if BX_DEBUGGER
#endif

View File

@ -38,32 +38,6 @@
extern "C" {
#endif /* __cplusplus */
BX_CPP_INLINE Bit16u bx_bswap16(Bit16u val16)
{
return (val16<<8) | (val16>>8);
}
#if BX_HAVE___BUILTIN_BSWAP32
#define bx_bswap32 __builtin_bswap32
#else
BX_CPP_INLINE Bit32u bx_bswap32(Bit32u val32)
{
val32 = ((val32<<8) & 0xFF00FF00) | ((val32>>8) & 0x00FF00FF);
return (val32<<16) | (val32>>16);
}
#endif
#if BX_HAVE___BUILTIN_BSWAP64
#define bx_bswap64 __builtin_bswap64
#else
BX_CPP_INLINE Bit64u bx_bswap64(Bit64u val64)
{
Bit32u lo = bx_bswap32((Bit32u)(val64 >> 32));
Bit32u hi = bx_bswap32((Bit32u)(val64 & 0xFFFFFFFF));
return ((Bit64u)hi << 32) | (Bit64u)lo;
}
#endif
//////////////////////////////////////////////////////////////////////
// Hacks for win32, but exclude MINGW32 because it doesn't need them.
//////////////////////////////////////////////////////////////////////