Skip to content

Instantly share code, notes, and snippets.

@msullivan
Created March 5, 2015 20:33
Show Gist options
  • Select an option

  • Save msullivan/9bd7ce24df1d6c48cd94 to your computer and use it in GitHub Desktop.

Select an option

Save msullivan/9bd7ce24df1d6c48cd94 to your computer and use it in GitHub Desktop.
"Launder" a value with inline asm
// Make a copy of a value that the compiler doesn't know anything about.
#define launder_value(v) \
({ \
__typeof__(v) __v = v; \
__asm__ __volatile__("" : "+r" (__v)::); \
__v; \
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment