diff options
| author | Simon Ser <contact@emersion.fr> | 2023-10-26 18:28:25 +0200 |
|---|---|---|
| committer | Simon Ser <contact@emersion.fr> | 2023-11-21 15:47:13 +0000 |
| commit | 2a91f01d6c617f8f2bd1c5bf18cfa9bd21a732f6 (patch) | |
| tree | 7470a71cc97a899dd48298c0a8ac37adf84374f0 /src | |
| parent | gitlab: make issue template the default (diff) | |
| download | wayland-2a91f01d6c617f8f2bd1c5bf18cfa9bd21a732f6.tar wayland-2a91f01d6c617f8f2bd1c5bf18cfa9bd21a732f6.tar.gz wayland-2a91f01d6c617f8f2bd1c5bf18cfa9bd21a732f6.tar.bz2 wayland-2a91f01d6c617f8f2bd1c5bf18cfa9bd21a732f6.tar.lz wayland-2a91f01d6c617f8f2bd1c5bf18cfa9bd21a732f6.tar.xz wayland-2a91f01d6c617f8f2bd1c5bf18cfa9bd21a732f6.tar.zst wayland-2a91f01d6c617f8f2bd1c5bf18cfa9bd21a732f6.zip | |
util: simplify wl_fixed_from_double()
Same as 0e0ae7e290f2 ("util: simplify wl_fixed_to_double()"), but
for the reverse function.
Signed-off-by: Simon Ser <contact@emersion.fr>
Diffstat (limited to 'src')
| -rw-r--r-- | src/wayland-util.h | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/wayland-util.h b/src/wayland-util.h index 272a3c0..1a451e4 100644 --- a/src/wayland-util.h +++ b/src/wayland-util.h @@ -626,14 +626,7 @@ wl_fixed_to_double(wl_fixed_t f) static inline wl_fixed_t wl_fixed_from_double(double d) { - union { - double d; - int64_t i; - } u; - - u.d = d + (3LL << (51 - 8)); - - return (wl_fixed_t)u.i; + return (wl_fixed_t) (d * 256.0); } /** |
