DescriptionReplace gfx::ClampToInt with base::saturated_cast.
This found a bug in saturated_cast that was covered by ClampToInt tests
so it fixes that.
If you have a floating point value of MAX_INT, then comparing an
integer against it for equality with promote it to a float and
it will compare true. However if you cast the float to an int, its
actually outside the bounds of integer, so you can end up with a
negative int as a result. Added unittests to check this for
saturated_cast.
Committed: https://crrev.com/3193742f0f9014ac342f54b0085986cef724252d
Cr-Commit-Position: refs/heads/master@{#333092}
Patch Set 1 #
Total comments: 1
Patch Set 2 : clamp: #Patch Set 3 : clamp: . #Patch Set 4 : clamp: . #Patch Set 5 : clamp: . #
Messages
Total messages: 11 (3 generated)
|