9 |
|
|
10 |
#define DPRINTF_BUF_SZ 1024 |
#define DPRINTF_BUF_SZ 1024 |
11 |
static void |
static void |
12 |
dprintf(char *fmt, |
DPRINTF(char *fmt, |
13 |
...) |
...) |
14 |
{ |
{ |
15 |
va_list args; |
va_list args; |
49 |
#define uint32_t unsigned int |
#define uint32_t unsigned int |
50 |
#define int64_t __int64 |
#define int64_t __int64 |
51 |
#define uint64_t unsigned __int64 |
#define uint64_t unsigned __int64 |
52 |
|
#define ptr_t uint32_t |
53 |
|
|
54 |
#define EMMS() __asm {emms} |
#define EMMS() __asm {emms} |
55 |
|
|
87 |
|
|
88 |
#elif defined(LINUX) || defined(DJGPP) || defined(FREEBSD) |
#elif defined(LINUX) || defined(DJGPP) || defined(FREEBSD) |
89 |
|
|
90 |
|
#include <stdio.h> |
91 |
|
#include <stdarg.h> |
92 |
|
#define DPRINTF_BUF_SZ 1024 |
93 |
|
static void |
94 |
|
DPRINTF(char *fmt, |
95 |
|
...) |
96 |
|
{ |
97 |
|
va_list args; |
98 |
|
char buf[DPRINTF_BUF_SZ]; |
99 |
|
|
100 |
|
va_start(args, fmt); |
101 |
|
vsprintf(buf, fmt, args); |
102 |
|
fprintf(stdout, "%s\n", buf); |
103 |
|
} |
104 |
|
|
105 |
#ifdef _DEBUG |
#ifdef _DEBUG |
106 |
|
|
107 |
#include <stdio.h> |
#include <stdio.h> |
121 |
#define DEBUGCBR(A,B,C) |
#define DEBUGCBR(A,B,C) |
122 |
#endif |
#endif |
123 |
|
|
|
#define CACHE_LINE 16 |
|
|
|
|
124 |
#if defined(LINUX) |
#if defined(LINUX) |
125 |
|
|
126 |
#include <stdint.h> |
#include <stdint.h> |
127 |
|
|
128 |
#define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
#define DECLARE_ALIGNED_MATRIX(name,sizex,sizey,type,alignment) \ |
129 |
type name##_storage[(sizex)*(sizey)+(alignment)-1]; \ |
type name##_storage[(sizex)*(sizey)+(alignment)-1]; \ |
130 |
type * name = (type *) (((int32_t) name##_storage+(alignment - 1)) & ~((int32_t)(alignment)-1)) |
type * name = (type *) (((ptr_t) name##_storage+(alignment - 1)) & ~((ptr_t)(alignment)-1)) |
131 |
|
|
132 |
#else |
#else |
133 |
|
|
179 |
} while (tb != get_tbl()); |
} while (tb != get_tbl()); |
180 |
return (((int64_t) tu) << 32) | (int64_t) tb; |
return (((int64_t) tu) << 32) | (int64_t) tb; |
181 |
} |
} |
182 |
|
|
183 |
|
#define ptr_t uint32_t |
184 |
|
|
185 |
|
#define CACHE_LINE 16 |
186 |
|
|
187 |
|
#elif defined(ARCH_IA64) |
188 |
|
|
189 |
|
#define ptr_t uint64_t |
190 |
|
|
191 |
|
#define CACHE_LINE 32 |
192 |
|
|
193 |
|
#define EMMS() |
194 |
|
|
195 |
|
// needed for bitstream.h |
196 |
|
#define BSWAP(a) \ |
197 |
|
((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff)) |
198 |
|
|
199 |
|
// rdtsc command most likely not supported, |
200 |
|
// so just dummy code here |
201 |
|
static __inline int64_t read_counter() { |
202 |
|
return 0; |
203 |
|
} |
204 |
|
|
205 |
#else |
#else |
206 |
#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) |
#define BSWAP(a) __asm__ ( "bswapl %0\n" : "=r" (a) : "0" (a) ) |
207 |
#define EMMS() __asm__("emms\n\t") |
#define EMMS() __asm__("emms\n\t") |
222 |
return ts; |
return ts; |
223 |
} |
} |
224 |
|
|
225 |
|
#define ptr_t uint32_t |
226 |
|
|
227 |
|
#define CACHE_LINE 16 |
228 |
|
|
229 |
#endif |
#endif |
230 |
|
|
231 |
#else // OTHER OS |
#else // OTHER OS |
232 |
|
|
233 |
|
|
234 |
|
#include <stdio.h> |
235 |
|
#include <stdarg.h> |
236 |
|
#define DPRINTF_BUF_SZ 1024 |
237 |
|
static void |
238 |
|
DPRINTF(char *fmt, |
239 |
|
...) |
240 |
|
{ |
241 |
|
va_list args; |
242 |
|
char buf[DPRINTF_BUF_SZ]; |
243 |
|
|
244 |
|
va_start(args, fmt); |
245 |
|
vsprintf(buf, fmt, args); |
246 |
|
fprintf(stdout, "%s\n", buf); |
247 |
|
} |
248 |
|
|
249 |
|
|
250 |
#define DEBUG(S) |
#define DEBUG(S) |
251 |
#define DEBUG1(S,I) |
#define DEBUG1(S,I) |
252 |
#define DEBUG2(X,A,B) |
#define DEBUG2(X,A,B) |
270 |
return 0; |
return 0; |
271 |
} |
} |
272 |
|
|
273 |
|
#define ptr_t uint32_t |
274 |
|
|
275 |
#define CACHE_LINE 16 |
#define CACHE_LINE 16 |
276 |
#define CACHE_ALIGN |
#define CACHE_ALIGN |
277 |
|
|