Created
March 5, 2015 20:33
-
-
Save msullivan/9bd7ce24df1d6c48cd94 to your computer and use it in GitHub Desktop.
"Launder" a value with inline asm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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