Java primitive arrays with non-native ByteOrder?

Uwe Schindler uschindler at apache.org
Sat Aug 14 09:08:20 UTC 2021


Hi,

Other question: is it possible to load wrong IEEE-754 bytes with Float#intBitsToFloat() ? If this works, i see no problems with MemoryAccess, too.

Uwe

Am 14. August 2021 09:03:26 UTC schrieb Uwe Schindler <uschindler at apache.org>:
>Hi,
>
>You can try it out and see what happens. From Lucene's point of view i already copied data from a mapped file using MemoryAccess (previously MemoryCopy) with wrong byte order into a float array. Nothing crashed, just bullshit came out.
>
>You may possibly create exceptions on StrictMath methods or strictfp, but we don't use that.
>
>Uwe
>
>Am 14. August 2021 04:38:57 UTC schrieb leerho <leerho at gmail.com>:
>>All,
>>
>>Can anyone think of cases where it would be desirable to load a Java
>>primitive array with non-native byte order values?  Assume that all reading
>>and writing to such an array by the user would always use the non-native
>>byte order.
>>
>>The integral types should always be valid, but doubles and floats could
>>become illegal IEEE 754 bit layouts if something in the JVM were to examine
>>them.  Assume that the user would not use any of the built-in static
>>methods like isNaN(double), etc.
>>
>>Would this cause any problems in the JVM?
>>
>>Has anyone done this?
>>
>>Cheers,
>>
>>Lee.


More information about the panama-dev mailing list