Fix problem with cmp_xchg when double

- Gcc 4.8 is not correctly optimizing the code when using cmp_xchg
  assembly instruction together with double. This change will fix it by
  first converting the double to uint64_t and then calling the cmp_xchg
  instruction.