From 4e944e676b0da4e5f3baea7ac8aeaec8aa26de34 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 2 Nov 2023 12:32:33 +0000 Subject: [PATCH] LibGfx: Use to_underlying() to compare ValueFormat enum values This means we no longer do a bitwise and of a u16 and i16, which feels a little sketchy. --- .../Libraries/LibGfx/Font/OpenType/Tables.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp index 52be013272..7c9f6599e2 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp +++ b/Userland/Libraries/LibGfx/Font/OpenType/Tables.cpp @@ -534,21 +534,21 @@ Optional GPOS::glyph_kerning(u16 left_glyph_id, u16 right_glyph_id) const { auto read_value_record = [&](u16 value_format, FixedMemoryStream& stream) -> ValueRecord { ValueRecord value_record; - if (value_format & static_cast(ValueFormat::X_PLACEMENT)) + if (value_format & to_underlying(ValueFormat::X_PLACEMENT)) value_record.x_placement = stream.read_value>().release_value_but_fixme_should_propagate_errors(); - if (value_format & static_cast(ValueFormat::Y_PLACEMENT)) + if (value_format & to_underlying(ValueFormat::Y_PLACEMENT)) value_record.y_placement = stream.read_value>().release_value_but_fixme_should_propagate_errors(); - if (value_format & static_cast(ValueFormat::X_ADVANCE)) + if (value_format & to_underlying(ValueFormat::X_ADVANCE)) value_record.x_advance = stream.read_value>().release_value_but_fixme_should_propagate_errors(); - if (value_format & static_cast(ValueFormat::Y_ADVANCE)) + if (value_format & to_underlying(ValueFormat::Y_ADVANCE)) value_record.y_advance = stream.read_value>().release_value_but_fixme_should_propagate_errors(); - if (value_format & static_cast(ValueFormat::X_PLACEMENT_DEVICE)) + if (value_format & to_underlying(ValueFormat::X_PLACEMENT_DEVICE)) value_record.x_placement_device_offset = stream.read_value().release_value_but_fixme_should_propagate_errors(); - if (value_format & static_cast(ValueFormat::Y_PLACEMENT_DEVICE)) + if (value_format & to_underlying(ValueFormat::Y_PLACEMENT_DEVICE)) value_record.y_placement_device_offset = stream.read_value().release_value_but_fixme_should_propagate_errors(); - if (value_format & static_cast(ValueFormat::X_ADVANCE_DEVICE)) + if (value_format & to_underlying(ValueFormat::X_ADVANCE_DEVICE)) value_record.x_advance_device_offset = stream.read_value().release_value_but_fixme_should_propagate_errors(); - if (value_format & static_cast(ValueFormat::Y_ADVANCE_DEVICE)) + if (value_format & to_underlying(ValueFormat::Y_ADVANCE_DEVICE)) value_record.y_advance_device_offset = stream.read_value().release_value_but_fixme_should_propagate_errors(); return value_record; };