[ 
https://issues.apache.org/jira/browse/KAFKA-10047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mickael Maison resolved KAFKA-10047.
------------------------------------
    Fix Version/s: 3.8.0
       Resolution: Fixed

> Unnecessary widening of (int to long) scope in FloatSerializer
> --------------------------------------------------------------
>
>                 Key: KAFKA-10047
>                 URL: https://issues.apache.org/jira/browse/KAFKA-10047
>             Project: Kafka
>          Issue Type: Task
>          Components: clients
>            Reporter: Guru Tahasildar
>            Priority: Trivial
>             Fix For: 3.8.0
>
>
> The following code is present in FloatSerializer:
> {code}
> long bits = Float.floatToRawIntBits(data);
> return new byte[] {
>     (byte) (bits >>> 24),
>     (byte) (bits >>> 16),
>     (byte) (bits >>> 8),
>     (byte) bits
> };
> {code}
> {{Float.floatToRawIntBits()}} returns an {{int}} but, the result is assigned 
> to a {{long}} so there is a widening of scope. This is not needed for any 
> subsequent operations hence, can be changed to use {{int}}.
> I would like to volunteer to make this change.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to