mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
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
1 changed files with 1 additions and 8 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue