You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Guru Tahasildar (Jira)" <ji...@apache.org> on 2020/05/27 03:29:01 UTC
[jira] [Created] (KAFKA-10047) Unnecessary widening of (int to
long) scope in FloatSerializer
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)