Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-10047

Unnecessary widening of (int to long) scope in FloatSerializer

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 3.8.0
    • clients
    • None

    Description

      The following code is present in FloatSerializer:

      long bits = Float.floatToRawIntBits(data);
      return new byte[] {
          (byte) (bits >>> 24),
          (byte) (bits >>> 16),
          (byte) (bits >>> 8),
          (byte) bits
      };
      

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            tguruprasad Guru Tahasildar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: