diff options
Diffstat (limited to 'test/include/test/bench.h')
-rw-r--r-- | test/include/test/bench.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/include/test/bench.h b/test/include/test/bench.h index 7421b4d2..29c6801f 100644 --- a/test/include/test/bench.h +++ b/test/include/test/bench.h @@ -58,3 +58,14 @@ compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a, dallocx(p, 0); } + +static inline void * +no_opt_ptr(void *ptr) { +#ifdef JEMALLOC_HAVE_ASM_VOLATILE + asm volatile("" : "+r"(ptr)); +#else + void *volatile dup = ptr; + ptr = dup; +#endif + return ptr; +} |