On Mon, 6 Feb 2023 08:44:22 GMT, Tagir F. Valeev <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/Math.java line 2213:
>>
>>> 2211: * @since 21
>>> 2212: */
>>> 2213: public static int clamp(long value, int min, int max) {
>>
>> There should probably also be a pure `int` overload:
>>
>> public static int clamp(int value, int min, int max)
>
> @ExE-Boss which problem such an overload would solve? It looks like, `int
> clamp(long, int, int)` can be used everywhere where proposed `int clamp(int,
> int, int)` could be useful.
A pure `int`‑only overload doesn’t have to go through the `int` → `long` →
`int` conversion.
-------------
PR: https://git.openjdk.org/jdk/pull/12428