RFR: 8341594: Use Unsafe to coalesce reads in java.util.zip.ZipUtils [v2]

Claes Redestad redestad at openjdk.org
Sun Oct 6 15:45:35 UTC 2024


On Sun, 6 Oct 2024 15:29:13 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   copyright
>
> src/java.base/share/classes/java/util/zip/ZipUtils.java line 258:
> 
>> 256:     static final long CENSIG(byte[] b, int pos) { return get32(b, pos + 0); }
>> 257:     static final int  CENVEM(byte[] b, int pos) { return get16(b, pos + 4); }
>> 258:     static final int  CENVEM_FA(byte[] b, int pos) { return Byte.toUnsignedInt(b[pos + 5]); } // file attribute compatibility
> 
> Did you consider introducing `get8` for consistency here? As it stands, this looks like the odd one out.

I considered it, but since `get8` would basically just delegate to or do exactly what `Byte.toUnsignedInt` does I opted to cut out the middle man.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21377#discussion_r1789139614


More information about the core-libs-dev mailing list