5 |
|
|
6 |
#include <windows.h> |
#include <windows.h> |
7 |
|
|
8 |
|
#ifdef _DEBUG |
9 |
#define DEBUG(S) OutputDebugString((S)); |
#define DEBUG(S) OutputDebugString((S)); |
10 |
#define DEBUG1(S,I) { char tmp[100]; wsprintf(tmp, "%s %i\n", (S), (I)); OutputDebugString(tmp); } |
#define DEBUG1(S,I) { char tmp[100]; wsprintf(tmp, "%s %i\n", (S), (I)); OutputDebugString(tmp); } |
11 |
#define DEBUG2(X,A,B) { char tmp[100]; wsprintf(tmp, "%s %i %i\n", (X), (A), (B)); OutputDebugString(tmp); } |
#define DEBUG2(X,A,B) { char tmp[100]; wsprintf(tmp, "%s %i %i\n", (X), (A), (B)); OutputDebugString(tmp); } |
12 |
#define DEBUG3(X,A,B,C){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i",(X),(A), (B), (C)); OutputDebugString(tmp); } |
#define DEBUG3(X,A,B,C){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i",(X),(A), (B), (C)); OutputDebugString(tmp); } |
13 |
#define DEBUG8(X,A,B,C,D,E,F,G,H){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i %i %i %i %i %i",(X),(A),(B),(C),(D),(E),(F),(G),(H)); OutputDebugString(tmp); } |
#define DEBUG8(X,A,B,C,D,E,F,G,H){ char tmp[1000]; wsprintf(tmp,"%s %i %i %i %i %i %i %i %i",(X),(A),(B),(C),(D),(E),(F),(G),(H)); OutputDebugString(tmp); } |
14 |
|
#else |
15 |
|
#define DEBUG(S) |
16 |
|
#define DEBUG1(S,I) |
17 |
|
#define DEBUG2(X,A,B) |
18 |
|
#define DEBUG3(X,A,B,C) |
19 |
|
#define DEBUG8(X,A,B,C,D,E,F,G,H) |
20 |
|
#endif |
21 |
|
|
22 |
|
|
23 |
#define int8_t char |
#define int8_t char |
31 |
|
|
32 |
#define EMMS() __asm {emms} |
#define EMMS() __asm {emms} |
33 |
|
|
34 |
|
#define CACHE_LINE 16 |
35 |
|
|
36 |
|
#if _MSC_VER <= 1200 |
37 |
|
#define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
38 |
|
type name##_storage[(sizex)*(sizey)+(alignment)-1]; \ |
39 |
|
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
40 |
|
#else |
41 |
|
#define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
42 |
|
__declspec(align(alignment)) type name[(sizex)*(sizey)] |
43 |
|
#endif |
44 |
|
|
45 |
// needed for bitstream.h |
// needed for bitstream.h |
46 |
#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 |
47 |
|
|
63 |
|
|
64 |
#elif defined(LINUX) || defined(DJGPP) |
#elif defined(LINUX) || defined(DJGPP) |
65 |
|
|
66 |
|
|
67 |
|
#ifdef _DEBUG |
68 |
|
|
69 |
#include <stdio.h> |
#include <stdio.h> |
70 |
#define DEBUG_WHERE stdout |
#define DEBUG_WHERE stdout |
71 |
#define DEBUG(S) fprintf(DEBUG_WHERE, "%s\n", (S)); |
#define DEBUG(S) fprintf(DEBUG_WHERE, "%s\n", (S)); |
73 |
#define DEBUG2(S,A,B) fprintf(DEBUG_WHERE, "%s%i=%i\n", (S), (A), (B)) |
#define DEBUG2(S,A,B) fprintf(DEBUG_WHERE, "%s%i=%i\n", (S), (A), (B)) |
74 |
#define DEBUG3(S,A,B,C) fprintf(DEBUG_WHERE, "%s %i %x %x\n", (S), (A), (B), (C)) |
#define DEBUG3(S,A,B,C) fprintf(DEBUG_WHERE, "%s %i %x %x\n", (S), (A), (B), (C)) |
75 |
#define DEBUG8(S,A,B,C,D,E,F,G,H) |
#define DEBUG8(S,A,B,C,D,E,F,G,H) |
76 |
|
#else |
77 |
|
#define DEBUG(S) |
78 |
|
#define DEBUG1(S,I) |
79 |
|
#define DEBUG2(X,A,B) |
80 |
|
#define DEBUG3(X,A,B,C) |
81 |
|
#define DEBUG8(X,A,B,C,D,E,F,G,H) |
82 |
|
#endif |
83 |
|
|
84 |
|
#define CACHE_LINE 16 |
85 |
|
|
86 |
#if defined(LINUX) |
#if defined(LINUX) |
87 |
|
|
88 |
#include <stdint.h> |
#include <stdint.h> |
89 |
|
|
90 |
|
#define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
91 |
|
type name##_storage[(sizex)*(sizey)+(alignment)-1]; \ |
92 |
|
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
93 |
|
|
94 |
#else |
#else |
95 |
|
|
96 |
|
#define #define #define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
97 |
|
__attribute__ ((__aligned__(CACHE_LINE))) type name[(sizex)*(sizey)] |
98 |
|
|
99 |
#define int8_t char |
#define int8_t char |
100 |
#define uint8_t unsigned char |
#define uint8_t unsigned char |
101 |
#define int16_t short |
#define int16_t short |
107 |
|
|
108 |
#endif |
#endif |
109 |
|
|
|
#define EMMS() __asm__("emms\n\t") |
|
110 |
|
|
111 |
// needed for bitstream.h |
// needed for bitstream.h |
112 |
|
#ifdef ARCH_PPC |
113 |
|
#define BSWAP(a) __asm__ ( "lwbrx %0,0,%1; eieio" : "=r" (a) : \ |
114 |
|
"r" (&(a)), "m" (a)); |
115 |
|
#define EMMS() |
116 |
|
#else |
117 |
#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) |
#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) |
118 |
|
#define EMMS() __asm__("emms\n\t") |
119 |
|
|
120 |
|
|
121 |
// needed for timer.c |
// needed for timer.c |
122 |
static __inline int64_t read_counter() { |
static __inline int64_t read_counter() { |
130 |
return ts; |
return ts; |
131 |
} |
} |
132 |
|
|
133 |
|
#endif |
134 |
|
|
135 |
#else // OTHER OS |
#else // OTHER OS |
136 |
|
|
137 |
#define DEBUG(S) |
#define DEBUG(S) |
154 |
return 0; |
return 0; |
155 |
} |
} |
156 |
|
|
157 |
|
#define CACHE_LINE 16 |
158 |
|
#define CACHE_ALIGN |
159 |
|
|
160 |
#endif |
#endif |
161 |
|
|
162 |
#endif // _PORTAB_H_ |
#endif // _PORTAB_H_ |