use memcpy instead of dubious union to type pun two values,
thanks to David Blaike for pointing this out.