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 17:12:00 UTC
[jira] [Assigned] (KAFKA-10047) Unnecessary widening of (int to
long) scope in FloatSerializer
[ https://issues.apache.org/jira/browse/KAFKA-10047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guru Tahasildar reassigned KAFKA-10047:
---------------------------------------
Assignee: Guru Tahasildar
> 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
> Assignee: Guru Tahasildar
> Priority: Trivial
>
> 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)