[Webkit-unassigned] [Bug 245356] Make narrowPrecisionToFloat() use clampTo<float>() instead of static_cast

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 21 14:25:54 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=245356

Ahmad Saleem <ahmad.saleem792 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Ahmad Saleem <ahmad.saleem792 at gmail.com> ---
Valid explanation from Darin on why this change is not right approach:

It’s fine to change this, but I don’t like the tactical choice.

If we want to use clampTo<float> we should change the call sites, not change the meaning of this function. The reason we invented narrowPrecisionToFloat was to give a way to convert to float that would not warn and would not be type-unsafe, since static_cast<float> can be used on other types, not just double. It’s possible that we don’t need that, and it would be better to clamp. If so, I’d like to be explicit about the clamping. Unless perhaps we want a type-safe version of clampTo<float> that compiles only for double and gives a compiler error if you use it on other types. In that case I think a new function would be OK, but I would not name it the same thing.

_____

If we need to do this, we either have another function "narrowPrecisionToFloat" for type-unsafe use case or type-safe use cases and brute forcing it for all is not ideal choice. Closing this as "RESOLVED INVALID".

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20221021/393292e2/attachment.htm>


More information about the webkit-unassigned mailing list