Guru Tahasildar created KAFKA-10047:
---------------------------------------

             Summary: 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


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.3.4#803005)

Reply via email to