typedef union {
struct {
uint64_t fraction : 52;
uint32_t exp_bias : 11;
uint32_t sign : 1;
} fields;
double value;
} binary64_float;
Accessing the value stored in "value" through the "fields" member is undefined behavior. I'm legitimately surprised that lemire published this code. The correct and well-defined way to do this is to memcpy() the double value to a char array and access the relevant bits that way.