Use a union for type-punning; enforce 64bit integer

- gcc 4.6.3 was throwing warnings; it seems the recommended way to pun
types is with unions as otherwise compiler optimizations can do
unexpected things.
- use uint64_t rather than unsigned long to enforce 64bit-ness (to
match that of double)
- We could just use R_IsNaN or R_IsNA, but both are much slower (around
2x faster if I use these unions)