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];
49 #define perf_start() asm volatile ( \
50 "xor %%eax, %%eax\n" \
54 : "=m"(perf_start_count) \
55 :: "%eax", "%ebx", "%ecx", "%edx")
57 #define perf_end() asm volatile ( \
58 "xor %%eax, %%eax\n" \
63 : "=m"(perf_interval_count) \
64 : "m"(perf_start_count) \
65 : "%eax", "%ebx", "%ecx", "%edx")
69 #define perf_start() \
75 mov [perf_start_count], eax \
85 sub eax, [perf_start_count] \
86 mov [perf_interval_count], eax \