kms/update: Use bitshifts for fixed_16 helpers

For easier understanding.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177>
This commit is contained in:
Robert Mader 2024-02-10 18:11:16 +01:00 committed by Marge Bot
parent 912cd80f10
commit d5fe58f355

View File

@ -200,19 +200,19 @@ void meta_kms_update_merge_from (MetaKmsUpdate *update,
static inline MetaFixed16 static inline MetaFixed16
meta_fixed_16_from_int (int16_t d) meta_fixed_16_from_int (int16_t d)
{ {
return d * 65536; return d * (1 << 16);
} }
static inline int16_t static inline int16_t
meta_fixed_16_to_int (MetaFixed16 fixed) meta_fixed_16_to_int (MetaFixed16 fixed)
{ {
return fixed / 65536; return fixed / (1 << 16);
} }
static inline double static inline double
meta_fixed_16_to_double (MetaFixed16 fixed) meta_fixed_16_to_double (MetaFixed16 fixed)
{ {
return fixed / 65536.0; return fixed / (double) (1 << 16);
} }
static inline MtkRectangle static inline MtkRectangle