On Mon, 9 Jan 2023 10:33:44 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove faulty test tag, improve other test tag, fix comments > > src/java.base/share/classes/java/io/Bits.java line 77: > >> 75: // Using Double.longBitsToDouble collapses NaN values to a single >> 76: // "canonical" NaN value >> 77: return Double.longBitsToDouble((long) LONG.get(b, off)); > > For the records, I believe the template classes for byte array var handle > already perform this conversion - e.g. > > > @ForceInline > static $type$ get(VarHandle ob, Object oba, int index) { > ArrayHandle handle = (ArrayHandle)ob; > byte[] ba = (byte[]) oba; > #if[floatingPoint] > $rawType$ rawValue = UNSAFE.get$RawType$Unaligned( > ba, > ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, > handle.be); > return $Type$.$rawType$BitsTo$Type$(rawValue); // > <----------------------------- > #else[floatingPoint] > return UNSAFE.get$Type$Unaligned( > ba, > ((long) index(ba, index)) + Unsafe.ARRAY_BYTE_BASE_OFFSET, > handle.be); > #end[floatingPoint] > } > ```` For the other direction it uses the `floatToRawIntBits`: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template#L148-L153 I think for symmatry we should keep it as is. ------------- PR: https://git.openjdk.org/jdk/pull/11840