[vector] ByteBuffer byte ordering
john.r.rose at oracle.com
Fri Apr 13 20:11:52 UTC 2018
On Apr 13, 2018, at 12:40 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> I still consider it an open question as to whether native order is the correct approach. For now i think what we have is ok, and ensures consistency with intrinsics.
> Intuitively it appears ok at least for byte, as there is a clear mapping to the vector load/stores. But those bytes may have come from somewhere else (e.g. off the network) so we may need to provide an optional argument specifying the byte-order (when order == native-order all is good, and when not some permutation of those bytes is required).
I question this also. BB's have an ordering flag for a reason, and it is risky to just reset it
to native for some operation.
A more correct approach would be to sense the BB's declared ordering flag, and then
perform swaps (only if needed) when loading data from the BB.
Of course, this more correct approach is most correct if the vector lanes are the
same size at the BB elements (so we're really talking about LongBuffer, etc.).
But it would be reasonable (less surprising on balance) to respect the flag,
or if that is impossible, throw an exception, rather than silently changing the
More information about the panama-dev