You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Mickael Maison (Jira)" <ji...@apache.org> on 2024/02/02 12:43: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 ]
Mickael Maison reassigned KAFKA-10047:
--------------------------------------
Assignee: (was: 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
> 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.20.10#820010)