The code is technically invalid C because it violates strict alias rules. However, if you tell your compiler not to abuse the alias rules, and you are guaranteed that double and int are laid out in memory, since they are on x86:
(int *)&x is a pointer to x . Appendix 1 moves the pointer forward 4 bytes. By dereferencing this, you get from the 4th to the 7th byte of double . You mask the high bit of this because it is the last double byte.
By the way, you can stop this due to anti-aliasing by using char * and adding 7 instead of 1. It is still terribly incapable.
source share