Commit Graph

4 Commits

Author SHA1 Message Date
Chris Vest
fb7279e82f Fix more test failures for UnsafeBuffer 2021-04-08 14:44:58 +02:00
Chris Vest
a7701c04b5 Update ByteCursor method names and related javadocs 2020-12-09 11:03:30 +01:00
Chris Vest
b2d0231f27 Specify the behaviour of ByteCursor.getByte and getLong, when relevant next* methods haven't been called 2020-12-09 11:02:51 +01:00
Chris Vest
6cc49c1c62 Turn ByteIterator into ByteCursor
Motivation:
Cursors are better than iterators in that they only need to check boundary conditions once per iteration, when processed in a loop.
This should make them easier for the compiler to optimise.

Modification:
Change the ByteIterator to a ByteCursor. The API is almost the same, but with a few subtle differences in semantics.
The primary difference is that the cursor movement and boundary condition checking and position movement happen at the same time, and do not need to occur when the values are fetched out of the cursor.
An iterator, on the other hand, needs to throw an exception if "next" is called too many times.

Result:
Simpler code, and hopefully faster code as well.
2020-12-09 11:02:51 +01:00