Regarding mainline:
- I decided not to 'unroll' the top while loop (i.e. `engineUpdate(byte[] 
input, int offset, int len)` is unrolled)
   - It is debatable which version is easier to understand. If this version is 
'too complex', I can unroll the top while loop. 
- I do think this version is incremental (i.e. easier to review?):
   - Move `remaining -= bytesToWrite;` into each `if` branch
   - Change first `if` case to process multiple blocks instead of one

This `while` loop has a lot of cases to remember; Very roughly:

1. process from previous call
2. process current data
3. store overflow

Interesting situations:
- `blockOffset` might be non-`0`
- `remaining+blockOffset` might not be enough to fill a single block. Or just 
enough for one block and to leave an overflow again..
- etc.

Regarding testing
- Correctness of intrinsic was already tested in 
https://github.com/openjdk/jdk/pull/10582 so not adding any tests there (i.e. 
no KAT)
- In principle, fuzz test should also be sufficient to test bytebuffer (did 
increase repetitions)

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

Commit messages:
 - whitespace
 - ByteBuffer support and tests

Changes: https://git.openjdk.org/jdk/pull/11338/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11338&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8297379
  Stats: 44 lines in 2 files changed: 33 ins; 2 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/11338.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11338/head:pull/11338

PR: https://git.openjdk.org/jdk/pull/11338

Reply via email to