util: simplify wl_fixed_from_double()
Same as 0e0ae7e290
("util: simplify wl_fixed_to_double()"), but
for the reverse function.
Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
parent
3007718b0c
commit
2a91f01d6c
|
@ -626,14 +626,7 @@ wl_fixed_to_double(wl_fixed_t f)
|
||||||
static inline wl_fixed_t
|
static inline wl_fixed_t
|
||||||
wl_fixed_from_double(double d)
|
wl_fixed_from_double(double d)
|
||||||
{
|
{
|
||||||
union {
|
return (wl_fixed_t) (d * 256.0);
|
||||||
double d;
|
|
||||||
int64_t i;
|
|
||||||
} u;
|
|
||||||
|
|
||||||
u.d = d + (3LL << (51 - 8));
|
|
||||||
|
|
||||||
return (wl_fixed_t)u.i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user