23 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
24 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 |
* |
* |
26 |
* $Id: portab.h,v 1.43 2003-02-15 15:22:17 edgomez Exp $ |
* $Id: portab.h,v 1.44 2003-02-16 01:41:24 edgomez Exp $ |
27 |
* |
* |
28 |
****************************************************************************/ |
****************************************************************************/ |
29 |
|
|
46 |
#define DPRINTF_DEBUG 0x80000000 |
#define DPRINTF_DEBUG 0x80000000 |
47 |
|
|
48 |
/* debug level for this library */ |
/* debug level for this library */ |
49 |
|
#ifdef _DEBUG |
50 |
|
#define DPRINTF_LEVEL 0x000000ff |
51 |
|
#else |
52 |
#define DPRINTF_LEVEL 0 |
#define DPRINTF_LEVEL 0 |
53 |
|
#endif |
54 |
|
|
55 |
/* Buffer size for msvc implementation because it outputs to DebugOutput */ |
/* Buffer size for msvc implementation because it outputs to DebugOutput */ |
56 |
#define DPRINTF_BUF_SZ 1024 |
#define DPRINTF_BUF_SZ 1024 |
115 |
#include <windows.h> |
#include <windows.h> |
116 |
#include <stdio.h> |
#include <stdio.h> |
117 |
|
|
118 |
|
/* Non ANSI mapping */ |
119 |
|
# define snprintf _snprintf |
120 |
|
# define vsnprintf _vsnprintf |
121 |
|
|
122 |
/* |
/* |
123 |
* This function must be declared/defined all the time because MSVC does |
* This function must be declared/defined all the time because MSVC does |
124 |
* not support C99 variable arguments macros. |
* not support C99 variable arguments macros. |
159 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
160 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) |
161 |
# 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 |
|
# define EMMS() __asm {emms} |
|
162 |
|
|
163 |
# ifdef _PROFILING_ |
# ifdef _PROFILING_ |
164 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
182 |
# define BSWAP(a) \ |
# define BSWAP(a) \ |
183 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
184 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
|
# define EMMS() |
|
185 |
|
|
186 |
# ifdef _PROFILING_ |
# ifdef _PROFILING_ |
187 |
# include <time.h> |
# include <time.h> |
246 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
247 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) |
248 |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
# define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ); |
|
# define EMMS() __asm__ ("emms\n\t"); |
|
249 |
|
|
250 |
# ifdef _PROFILING_ |
# ifdef _PROFILING_ |
251 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
264 |
# elif defined(ARCH_IS_PPC) |
# elif defined(ARCH_IS_PPC) |
265 |
# define BSWAP(a) __asm__ __volatile__ \ |
# define BSWAP(a) __asm__ __volatile__ \ |
266 |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
( "lwbrx %0,0,%1; eieio" : "=r" (a) : "r" (&(a)), "m" (a)); |
|
# define EMMS() |
|
267 |
|
|
268 |
# ifdef _PROFILING_ |
# ifdef _PROFILING_ |
269 |
static __inline unsigned long get_tbl(void) |
static __inline unsigned long get_tbl(void) |
298 |
# define BSWAP(a) __asm__ __volatile__ \ |
# define BSWAP(a) __asm__ __volatile__ \ |
299 |
("mux1 %1 = %0, @rev" ";;" \ |
("mux1 %1 = %0, @rev" ";;" \ |
300 |
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
"shr.u %1 = %1, 32" : "=r" (a) : "r" (a)); |
|
# define EMMS() |
|
301 |
|
|
302 |
# ifdef _PROFILING_ |
# ifdef _PROFILING_ |
303 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
315 |
# define BSWAP(a) \ |
# define BSWAP(a) \ |
316 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
317 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
|
# define EMMS() |
|
318 |
|
|
319 |
# ifdef _PROFILING_ |
# ifdef _PROFILING_ |
320 |
# include <time.h> |
# include <time.h> |
332 |
# error You are trying to compile XviD without defining the architecture type. |
# error You are trying to compile XviD without defining the architecture type. |
333 |
# endif |
# endif |
334 |
|
|
335 |
|
|
336 |
|
|
337 |
|
|
338 |
/***************************************************************************** |
/***************************************************************************** |
339 |
* OPEN WATCOM C/C++ compiler |
* Open WATCOM C/C++ compiler |
340 |
****************************************************************************/ |
****************************************************************************/ |
341 |
|
|
342 |
#elif defined(__WATCOMC__) |
#elif defined(__WATCOMC__) |
343 |
|
|
344 |
# include <stdio.h> |
# include <stdio.h> |
364 |
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
365 |
|
|
366 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
367 |
| watcom x86 specific macros/functions |
| watcom ia32 specific macros/functions |
368 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
369 |
# if defined(ARCH_IS_IA32) |
# if defined(ARCH_IS_IA32) |
370 |
|
|
371 |
# 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 |
372 |
# define EMMS() __asm {emms} |
|
373 |
# ifdef _PROFILING_ |
# ifdef _PROFILING_ |
374 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
375 |
{ |
{ |
386 |
# endif |
# endif |
387 |
|
|
388 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
389 |
| watcom unsupported architecture |
| watcom GENERIC (plain C only) specific macros/functions. |
390 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
391 |
# else |
# elif defined(ARCH_IS_GENERIC) |
392 |
|
|
393 |
# define BSWAP(x) \ |
# define BSWAP(x) \ |
394 |
x = ((((x) & 0xff000000) >> 24) | \ |
x = ((((x) & 0xff000000) >> 24) | \ |
395 |
(((x) & 0x00ff0000) >> 8) | \ |
(((x) & 0x00ff0000) >> 8) | \ |
396 |
(((x) & 0x0000ff00) << 8) | \ |
(((x) & 0x0000ff00) << 8) | \ |
397 |
(((x) & 0x000000ff) << 24)) |
(((x) & 0x000000ff) << 24)) |
398 |
# define EMMS() |
|
399 |
# ifdef _PROFILING_ |
# ifdef _PROFILING_ |
400 |
static int64_t read_counter() { return 0; } |
static int64_t read_counter() { return 0; } |
401 |
# endif |
# endif |
402 |
|
|
403 |
|
/*---------------------------------------------------------------------------- |
404 |
|
| watcom Not given architecture - This is probably an user who tries to build |
405 |
|
| XviD the wrong way. |
406 |
|
*---------------------------------------------------------------------------*/ |
407 |
|
# else |
408 |
|
# error You are trying to compile XviD without defining the architecture type. |
409 |
# endif |
# endif |
410 |
|
|
411 |
|
|
412 |
/***************************************************************************** |
/***************************************************************************** |
413 |
* Unknown compiler |
* Unknown compiler |
414 |
****************************************************************************/ |
****************************************************************************/ |
445 |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
446 |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
447 |
|
|
|
# define EMMS() |
|
|
|
|
448 |
# ifdef _PROFILING_ |
# ifdef _PROFILING_ |
449 |
# include <time.h> |
# include <time.h> |
450 |
static __inline int64_t read_counter(void) |
static __inline int64_t read_counter(void) |
459 |
#endif /* Compiler test */ |
#endif /* Compiler test */ |
460 |
|
|
461 |
|
|
462 |
#endif |
#endif /* PORTAB_H */ |