71 |
#define DPRINTF_MB 0x00000010 |
#define DPRINTF_MB 0x00000010 |
72 |
#define DPRINTF_COEFF 0x00000020 |
#define DPRINTF_COEFF 0x00000020 |
73 |
#define DPRINTF_MV 0x00000040 |
#define DPRINTF_MV 0x00000040 |
|
#define DPRINTF_RC 0x00000080 |
|
74 |
#define DPRINTF_DEBUG 0x80000000 |
#define DPRINTF_DEBUG 0x80000000 |
75 |
|
|
76 |
/* debug level for this library */ |
/* debug level for this library */ |
77 |
#ifdef _DEBUG |
#define DPRINTF_LEVEL 0 |
|
#define DPRINTF_LEVEL (DPRINTF_RC|0x0000007F) |
|
|
#else |
|
|
#define DPRINTF_LEVEL DPRINTF_RC |
|
|
#endif |
|
78 |
|
|
79 |
/* Buffer size for non C99 compliant compilers (msvc) */ |
/* Buffer size for non C99 compliant compilers (msvc) */ |
80 |
#define DPRINTF_BUF_SZ 1024 |
#define DPRINTF_BUF_SZ 1024 |
140 |
# define CACHE_LINE 32 |
# define CACHE_LINE 32 |
141 |
# define ptr_t uint64_t |
# define ptr_t uint64_t |
142 |
#else |
#else |
143 |
/* todo: fix cache_line 0 operation */ |
# error Architecture not supported. |
|
# define CACHE_LINE 16 |
|
|
# define ptr_t uint32_t |
|
144 |
#endif |
#endif |
145 |
|
|
146 |
/***************************************************************************** |
/***************************************************************************** |
160 |
#include <windows.h> |
#include <windows.h> |
161 |
#include <stdio.h> |
#include <stdio.h> |
162 |
|
|
|
/* non-ansi function mapping */ |
|
|
# define snprintf _snprintf |
|
|
# define vsnprintf _vsnprintf |
|
|
|
|
163 |
/* |
/* |
164 |
* This function must be declared/defined all the time because MSVC does |
* This function must be declared/defined all the time because MSVC does |
165 |
* not support C99 variable arguments macros |
* not support C99 variable arguments macros |
191 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
192 |
# if defined(ARCH_X86) |
# if defined(ARCH_X86) |
193 |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
194 |
|
# define EMMS() __asm {emms} |
195 |
|
|
196 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
197 |
{ |
{ |
210 |
| msvc unknown architecture |
| msvc unknown architecture |
211 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
212 |
# else |
# else |
213 |
/* ANSI C version of BSWAP */ |
# error Architecture not supported. |
|
#define BSWAP(x) \ |
|
|
x = ((((x) & 0xff000000) >> 24) | \ |
|
|
(((x) & 0x00ff0000) >> 8) | \ |
|
|
(((x) & 0x0000ff00) << 8) | \ |
|
|
(((x) & 0x000000ff) << 24)) |
|
|
|
|
214 |
# endif |
# endif |
215 |
|
|
216 |
|
|
256 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
257 |
# if defined(ARCH_X86) |
# if defined(ARCH_X86) |
258 |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
259 |
|
# define EMMS() __asm__ ("emms\n\t"); |
260 |
|
|
261 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
262 |
{ |
{ |
273 |
# elif defined(ARCH_PPC) |
# elif defined(ARCH_PPC) |
274 |
# define BSWAP(a) __asm__ __volatile__ \ |
# define BSWAP(a) __asm__ __volatile__ \ |
275 |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
276 |
|
# define EMMS() |
277 |
|
|
278 |
static __inline unsigned long get_tbl(void) |
static __inline unsigned long get_tbl(void) |
279 |
{ |
{ |
306 |
# define BSWAP(a) __asm__ __volatile__ \ |
# define BSWAP(a) __asm__ __volatile__ \ |
307 |
("mux1 %1 = %0, @rev" ";;" \ |
("mux1 %1 = %0, @rev" ";;" \ |
308 |
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
309 |
|
# define EMMS() |
310 |
|
|
311 |
static __inline int64_t read_counter(void) { |
static __inline int64_t read_counter(void) { |
312 |
unsigned long result; |
unsigned long result; |
321 |
# define BSWAP(a) \ |
# define BSWAP(a) \ |
322 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
323 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
324 |
|
# define EMMS() |
325 |
|
|
326 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
327 |
{ |
{ |
335 |
# define BSWAP(a) \ |
# define BSWAP(a) \ |
336 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
337 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
338 |
|
# define EMMS() |
339 |
|
|
340 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
341 |
{ |
{ |
346 |
| XviD + gcc unsupported Architecture |
| XviD + gcc unsupported Architecture |
347 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
348 |
# else |
# else |
349 |
/* ANSI C version of BSWAP */ |
# error Architecture not supported. |
|
#define BSWAP(x) \ |
|
|
x = ((((x) & 0xff000000) >> 24) | \ |
|
|
(((x) & 0x00ff0000) >> 8) | \ |
|
|
(((x) & 0x0000ff00) << 8) | \ |
|
|
(((x) & 0x000000ff) << 24)) |
|
|
|
|
350 |
# endif /* Architecture checking */ |
# endif /* Architecture checking */ |
351 |
|
|
352 |
/***************************************************************************** |
/***************************************************************************** |