52 |
* exception also makes it possible to release a modified version which |
* exception also makes it possible to release a modified version which |
53 |
* carries forward this exception. |
* carries forward this exception. |
54 |
* |
* |
55 |
* $Id: portab.h,v 1.26.2.7 2003-01-26 05:09:00 suxen_drol Exp $ |
* $Id: portab.h,v 1.26.2.8 2003-02-15 08:39:17 suxen_drol Exp $ |
56 |
* |
* |
57 |
****************************************************************************/ |
****************************************************************************/ |
58 |
|
|
101 |
| msvc (lacks such a header file) |
| msvc (lacks such a header file) |
102 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
103 |
|
|
104 |
#elif defined(_MSC_VER) |
#elif defined(_MSC_VER) || defined (__WATCOMC__) |
105 |
# define int8_t char |
# define int8_t char |
106 |
# define uint8_t unsigned char |
# define uint8_t unsigned char |
107 |
# define int16_t short |
# define int16_t short |
367 |
# endif /* Architecture checking */ |
# endif /* Architecture checking */ |
368 |
|
|
369 |
/***************************************************************************** |
/***************************************************************************** |
370 |
|
* OPEN WATCOM C/C++ compiler |
371 |
|
****************************************************************************/ |
372 |
|
#elif defined(__WATCOMC__) |
373 |
|
|
374 |
|
# include <stdio.h> |
375 |
|
# include <stdarg.h> |
376 |
|
|
377 |
|
static __inline void DPRINTF(int level, char *fmt, ...) |
378 |
|
{ |
379 |
|
if (DPRINTF_LEVEL & level) { |
380 |
|
va_list args; |
381 |
|
char buf[DPRINTF_BUF_SZ]; |
382 |
|
va_start(args, fmt); |
383 |
|
vsprintf(buf, fmt, args); |
384 |
|
fprintf(stderr, "%s\n", buf); |
385 |
|
} |
386 |
|
} |
387 |
|
|
388 |
|
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
389 |
|
type name##_storage[(sizex)*(sizey)+(alignment)-1]; \ |
390 |
|
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
391 |
|
|
392 |
|
/*---------------------------------------------------------------------------- |
393 |
|
| watcom x86 specific macros/functions |
394 |
|
*---------------------------------------------------------------------------*/ |
395 |
|
# if defined(ARCH_X86) |
396 |
|
|
397 |
|
# define BSWAP(a) __asm mov eax,a __asm bswap eax __asm mov a, eax |
398 |
|
|
399 |
|
static __inline int64_t read_counter(void) |
400 |
|
{ |
401 |
|
int64_t ts; |
402 |
|
uint32_t ts1, ts2; |
403 |
|
__asm { |
404 |
|
rdtsc |
405 |
|
mov ts1, eax |
406 |
|
mov ts2, edx |
407 |
|
} |
408 |
|
ts = ((uint64_t) ts2 << 32) | ((uint64_t) ts1); |
409 |
|
return ts; |
410 |
|
} |
411 |
|
|
412 |
|
/*---------------------------------------------------------------------------- |
413 |
|
| watcom unsupported architecture |
414 |
|
*---------------------------------------------------------------------------*/ |
415 |
|
# else |
416 |
|
|
417 |
|
# define BSWAP(x) \ |
418 |
|
x = ((((x) & 0xff000000) >> 24) | \ |
419 |
|
(((x) & 0x00ff0000) >> 8) | \ |
420 |
|
(((x) & 0x0000ff00) << 8) | \ |
421 |
|
(((x) & 0x000000ff) << 24)) |
422 |
|
|
423 |
|
static int64_t read_counter() { return 0; } |
424 |
|
|
425 |
|
# endif |
426 |
|
/***************************************************************************** |
427 |
* Unknown compiler |
* Unknown compiler |
428 |
****************************************************************************/ |
****************************************************************************/ |
429 |
#else /* Compiler test */ |
#else /* Compiler test */ |