7 #define INLINE __inline
9 #elif defined(__WATCOMC__)
10 #define INLINE __inline
16 /* fast conversion of double -> 32bit int
18 * - http://chrishecker.com/images/f/fb/Gdmfp.pdf
19 * - http://stereopsis.com/FPU.html#convert
21 static INLINE int32_t cround64(double val)
23 val += 6755399441055744.0;
24 return *(int32_t*)&val;
27 extern uint32_t perf_start_count, perf_interval_count;
30 void perf_start(void);
31 #pragma aux perf_start = \
35 "mov [perf_start_count], eax" \
36 modify[eax ebx ecx edx];
39 #pragma aux perf_end = \
43 "sub eax, [perf_start_count]" \
44 "mov [perf_interval_count], eax" \
45 modify [eax ebx ecx edx];
47 void debug_break(void);
48 #pragma aux debug_break = "int 3";
52 #define perf_start() asm volatile ( \
53 "xor %%eax, %%eax\n" \
57 : "=m"(perf_start_count) \
58 :: "%eax", "%ebx", "%ecx", "%edx")
60 #define perf_end() asm volatile ( \
61 "xor %%eax, %%eax\n" \
66 : "=m"(perf_interval_count) \
67 : "m"(perf_start_count) \
68 : "%eax", "%ebx", "%ecx", "%edx")
70 #define debug_break() \
71 asm volatile ("int $3")
75 #define perf_start() \
81 mov [perf_start_count], eax \
91 sub eax, [perf_start_count] \
92 mov [perf_interval_count], eax \
96 #define debug_break() \