Skip to content

Instantly share code, notes, and snippets.

@pankkor
Last active February 5, 2023 18:08
Show Gist options
  • Save pankkor/87b25aa8a9bc8841d39dbbe4a572f228 to your computer and use it in GitHub Desktop.
Save pankkor/87b25aa8a9bc8841d39dbbe4a572f228 to your computer and use it in GitHub Desktop.
// disable optimisations
#ifdef _MSC_VER
#pragma optimize("", off)
inline void bench_opt_off(const void*) {}
#pragma optimize("", on)
#define ESCAPE(p) bench_opt_off(p)
#define CLOBBER(p) bench_opt_off(p)
#else
#define ESCAPE(p) asm volatile("" : : "m"(p) : "memory")
#define CLOBBER() asm volatile("" : : : "memory")
#endif // #ifdef _MSC_VER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment