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:
Simon Ser 2023-10-26 18:28:25 +02:00
parent 3007718b0c
commit 2a91f01d6c

View File

@ -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;
} }
/** /**