3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-19 12:23:38 +00:00

Eliminated reinterpret_casts. Partially fixes #24, #229.

This commit is contained in:
Christoph M. Wintersteiger 2015-10-04 15:52:20 +01:00
parent c636c87e4d
commit 4626196907
2 changed files with 11 additions and 6 deletions

View file

@ -85,8 +85,9 @@ hwf_manager::~hwf_manager()
{
}
#define RAW(X) (*reinterpret_cast<const uint64*>(&(X)))
#define DBL(X) (*reinterpret_cast<const double*>(&(X)))
// #define RAW(X) (*reinterpret_cast<const uint64*>(&(X)))
#define RAW(X) ({ uint64 tmp; memcpy(&tmp, &(X), sizeof(uint64)); tmp; })
#define DBL(X) ({ double tmp; memcpy(&tmp, &(X), sizeof(double)); tmp; })
void hwf_manager::set(hwf & o, int value) {
o.value = (double) value;
@ -166,7 +167,7 @@ void hwf_manager::set(hwf & o, bool sign, uint64 significand, int exponent) {
uint64 raw = (sign?0x8000000000000000ull:0);
raw |= (((uint64)exponent) + 1023) << 52;
raw |= significand;
o.value = *reinterpret_cast<double*>(&raw);
memcpy(&o.value, &raw, sizeof(double));
}
void hwf_manager::set(hwf & o, hwf const & x) {