1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:17:35 +00:00

LibWeb: Fix a rounding issue on CSSPixels multiplication

Co-Authored-By: ronak69 <ronak69@danwin1210.de>
This commit is contained in:
Hendiadyoin1 2023-08-18 16:09:11 +02:00 committed by Alexander Kalenik
parent 096cecb95e
commit b342b4dfb8
2 changed files with 9 additions and 2 deletions

View file

@ -170,8 +170,8 @@ public:
// Rounding:
// If last bit cut off was 1:
if (value & (1u << (fractional_bits - 1))) {
// If the bit after was 1 as well
if (value & (radix_mask >> 2u)) {
// If any bit after was 1 as well
if (value & (radix_mask >> 1u)) {
// We need to round away from 0
int_value = Checked<int>::saturating_add(int_value, 1);
} else {