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.41 2003-02-09 19:32:52 edgomez Exp $ |
* $Id: portab.h,v 1.42 2003-02-09 22:48:38 edgomez Exp $ |
56 |
* |
* |
57 |
****************************************************************************/ |
****************************************************************************/ |
58 |
|
|
76 |
/* debug level for this library */ |
/* debug level for this library */ |
77 |
#define DPRINTF_LEVEL 0 |
#define DPRINTF_LEVEL 0 |
78 |
|
|
79 |
/* Buffer size for non C99 compliant compilers (msvc) */ |
/* Buffer size for msvc implementation because it outputs to DebugOutput */ |
80 |
#define DPRINTF_BUF_SZ 1024 |
#define DPRINTF_BUF_SZ 1024 |
81 |
|
|
82 |
/***************************************************************************** |
/***************************************************************************** |
98 |
# define uint64_t unsigned __int64 |
# define uint64_t unsigned __int64 |
99 |
|
|
100 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
101 |
| For GNU C compatible compilers |
| For all other compilers, use the standard header file |
102 |
|
| (compiler should be ISO C99 compatible, perhaps ISO C89 is enough) |
103 |
*---------------------------------------------------------------------------*/ |
*---------------------------------------------------------------------------*/ |
104 |
|
|
105 |
#elif defined(__GNUC__) || defined(__ICC) |
#else |
|
|
|
|
# define int8_t char |
|
|
# define uint8_t unsigned char |
|
|
# define int16_t short |
|
|
# define uint16_t unsigned short |
|
|
# define int32_t int |
|
|
# define uint32_t unsigned int |
|
|
# define int64_t long long |
|
|
# define uint64_t unsigned long long |
|
106 |
|
|
107 |
/*---------------------------------------------------------------------------- |
# include <inttypes.h> |
|
| Ok, we don't know how to define these types... error |
|
|
*---------------------------------------------------------------------------*/ |
|
108 |
|
|
|
#else |
|
|
# error Do not know how to define (u)int(size)_t types. |
|
109 |
#endif |
#endif |
110 |
|
|
111 |
/***************************************************************************** |
/***************************************************************************** |
363 |
****************************************************************************/ |
****************************************************************************/ |
364 |
#else /* Compiler test */ |
#else /* Compiler test */ |
365 |
|
|
366 |
# error Compiler not supported |
/* |
367 |
|
* Ok we know nothing about the compiler, so we fallback to ANSI C |
368 |
|
* features, so every compiler should be happy and compile the code. |
369 |
|
* |
370 |
|
* This is (mostly) equivalent to ARCH_IS_GENERIC. |
371 |
|
*/ |
372 |
|
|
373 |
|
# ifdef _DEBUG |
374 |
|
|
375 |
|
/* Needed for all debuf fprintf calls */ |
376 |
|
# include <stdio.h> |
377 |
|
# include <stdarg.h> |
378 |
|
|
379 |
|
static __inline void DPRINTF(int level, char *format, ...) |
380 |
|
{ |
381 |
|
va_list args; |
382 |
|
va_start(args, format); |
383 |
|
if(DPRINTF_LEVEL & level) { |
384 |
|
vfprintf(stderr, format, args); |
385 |
|
fprintf(stderr, "\n"); |
386 |
|
} |
387 |
|
} |
388 |
|
|
389 |
|
# else /* _DEBUG */ |
390 |
|
static __inline void DPRINTF(int level, char *format, ...) {} |
391 |
|
# endif /* _DEBUG */ |
392 |
|
|
393 |
|
# define BSWAP(a) \ |
394 |
|
((a) = (((a) & 0xff) << 24) | (((a) & 0xff00) << 8) | \ |
395 |
|
(((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff)) |
396 |
|
|
397 |
|
# define EMMS() |
398 |
|
|
399 |
|
# ifdef _PROFILING_ |
400 |
|
# include <time.h> |
401 |
|
static __inline int64_t read_counter(void) |
402 |
|
{ |
403 |
|
return (int64_t)clock(); |
404 |
|
} |
405 |
|
# endif |
406 |
|
|
407 |
|
# define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
408 |
|
type name[(sizex)*(sizey)] |
409 |
|
|
410 |
#endif /* Compiler test */ |
#endif /* Compiler test */ |
411 |
|
|