浏览代码

LibWeb: Use llround in CSS::Token::to_closest_integer

This should be equivalent, and much shorter than a clamp and static_cast
Hendiadyoin1 3 年之前
父节点
当前提交
2f2efc4775
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Userland/Libraries/LibWeb/CSS/Parser/Token.h

+ 1 - 1
Userland/Libraries/LibWeb/CSS/Parser/Token.h

@@ -171,7 +171,7 @@ private:
         // When a value cannot be explicitly supported due to range/precision limitations, it must be converted
         // to the closest value supported by the implementation, but how the implementation defines "closest"
         // is explicitly undefined as well.
-        return static_cast<i64>(clamp(round(value), NumericLimits<i64>::min(), NumericLimits<i64>::max()));
+        return llround(value);
     }
 
     Type m_type { Type::Invalid };