Avoid type punning by using an integer/float union
This commit is contained in:
parent
c57a72705c
commit
f29cb50ff7
@ -62,7 +62,14 @@ ieee_float<E, S>::operator==(floating_t _floating) const {
|
|||||||
// C++'s template bullshit for tonight.
|
// C++'s template bullshit for tonight.
|
||||||
check_hard (bits_type<TOTAL_BITS>::has_floating);
|
check_hard (bits_type<TOTAL_BITS>::has_floating);
|
||||||
|
|
||||||
return m_bits == *(const uint_t*)&_floating;
|
union {
|
||||||
|
floating_t _floating;
|
||||||
|
uint_t _uint;
|
||||||
|
} convertor;
|
||||||
|
|
||||||
|
convertor._floating = _floating;
|
||||||
|
|
||||||
|
return m_bits == convertor._uint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user