On Mon, 24 Mar 2025 14:50:49 GMT, Chen Liang <li...@openjdk.org> wrote:
>> @liach, `initVectorMask()` operates byte-by-byte, that is, nothing >> vectorized, and, hence, no endianness concerns there. `applyVectorMask()` >> chooses the mask with correct endianness based on the input: >> >> >> assert src.order() == dst.order() : "vectorized masking is only allowed on >> matching byte orders"; >> long maskLong = ByteOrder.LITTLE_ENDIAN == src.order() ? maskLongLe : >> maskLongBe; >> >> >> AFAICT, both methods are ready to perform vectorization independent of the >> input endianness – granted `src` and `dst` endiannesses match. Am I missing >> something? > > For this line below: > > dst.put(j, (byte) (src.get(i) ^ maskBytes[offset])); > > Because `maskBytes` is big-endian, if `dst` is little-endian (which is not > the case at all right now because trusted callers are all using BE dst > ByteBuffer), we should use `maskBytes[4 - offset]`, right? (Resolving this conversation, since it continues in a subsequent thread.) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24033#discussion_r2013728281