--- portab.h 2003/02/15 08:39:17 1.26.2.8 +++ portab.h 2002/11/26 23:50:57 1.39 @@ -52,7 +52,7 @@ * exception also makes it possible to release a modified version which * carries forward this exception. * - * $Id: portab.h,v 1.26.2.8 2003/02/15 08:39:17 suxen_drol Exp $ + * $Id: portab.h,v 1.39 2002/11/26 23:50:57 edgomez Exp $ * ****************************************************************************/ @@ -71,15 +71,10 @@ #define DPRINTF_MB 0x00000010 #define DPRINTF_COEFF 0x00000020 #define DPRINTF_MV 0x00000040 -#define DPRINTF_RC 0x00000080 #define DPRINTF_DEBUG 0x80000000 /* debug level for this library */ -#ifdef _DEBUG -#define DPRINTF_LEVEL (DPRINTF_RC|0x0000007F) -#else -#define DPRINTF_LEVEL DPRINTF_RC -#endif +#define DPRINTF_LEVEL 0 /* Buffer size for non C99 compliant compilers (msvc) */ #define DPRINTF_BUF_SZ 1024 @@ -101,7 +96,7 @@ | msvc (lacks such a header file) *---------------------------------------------------------------------------*/ -#elif defined(_MSC_VER) || defined (__WATCOMC__) +#elif defined(_MSC_VER) # define int8_t char # define uint8_t unsigned char # define int16_t short @@ -167,10 +162,6 @@ #include #include - /* non-ansi function mapping */ -# define snprintf _snprintf -# define vsnprintf _vsnprintf - /* * This function must be declared/defined all the time because MSVC does * not support C99 variable arguments macros @@ -202,6 +193,7 @@ *---------------------------------------------------------------------------*/ # if defined(ARCH_X86) # define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax +# define EMMS() __asm {emms} static __inline int64_t read_counter(void) { @@ -227,6 +219,7 @@ (((x) & 0x0000ff00) << 8) | \ (((x) & 0x000000ff) << 24)) +#define EMMS() # endif @@ -272,6 +265,7 @@ *---------------------------------------------------------------------------*/ # if defined(ARCH_X86) # define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); +# define EMMS() __asm__ ("emms\n\t"); static __inline int64_t read_counter(void) { @@ -288,6 +282,7 @@ # elif defined(ARCH_PPC) # define BSWAP(a) __asm__ __volatile__ \ ( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); +# define EMMS() static __inline unsigned long get_tbl(void) { @@ -320,6 +315,7 @@ # define BSWAP(a) __asm__ __volatile__ \ ("mux1 %1 = %0, @rev" ";;" \ "shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); +# define EMMS() static __inline int64_t read_counter(void) { unsigned long result; @@ -334,6 +330,7 @@ # define BSWAP(a) \ ((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) +# define EMMS() static __inline int64_t read_counter(void) { @@ -347,6 +344,7 @@ # define BSWAP(a) \ ((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) +# define EMMS() static __inline int64_t read_counter(void) { @@ -364,66 +362,10 @@ (((x) & 0x0000ff00) << 8) | \ (((x) & 0x000000ff) << 24)) +#define EMMS() # endif /* Architecture checking */ /***************************************************************************** - * OPEN WATCOM C/C++ compiler - ****************************************************************************/ -#elif defined(__WATCOMC__) - -# include -# include - - static __inline void DPRINTF(int level, char *fmt, ...) - { - if (DPRINTF_LEVEL & level) { - va_list args; - char buf[DPRINTF_BUF_SZ]; - va_start(args, fmt); - vsprintf(buf, fmt, args); - fprintf(stderr, "%s\n", buf); - } - } - -# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ - type name##_storage[(sizex)*(sizey)+(alignment)-1]; \ - type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) - -/*---------------------------------------------------------------------------- - | watcom x86 specific macros/functions - *---------------------------------------------------------------------------*/ -# if defined(ARCH_X86) - -# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax - - static __inline int64_t read_counter(void) - { - int64_t ts; - uint32_t ts1, ts2; - __asm { - rdtsc - mov ts1, eax - mov ts2, edx - } - ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); - return ts; - } - -/*---------------------------------------------------------------------------- - | watcom unsupported architecture - *---------------------------------------------------------------------------*/ -# else - -# define BSWAP(x) \ - x = ((((x) & 0xff000000) >> 24) | \ - (((x) & 0x00ff0000) >> 8) | \ - (((x) & 0x0000ff00) << 8) | \ - (((x) & 0x000000ff) << 24)) - - static int64_t read_counter() { return 0; } - -# endif -/***************************************************************************** * Unknown compiler ****************************************************************************/ #else /* Compiler test */