apache / datasketches-memory

High performance native memory access for Java.
https://datasketches.apache.org
Apache License 2.0
118 stars 27 forks source link

Fix issue 178 #179

Closed leerho closed 4 months ago

leerho commented 4 months ago

As reported in issue #178:

static Memory wrap(byte[] array, int offsetBytes, int lengthBytes, ByteOrder byteOrder) ... ... return BaseWritableMemoryImpl.wrapHeapArray(array, 0, lengthBytes, true, ByteOrder.nativeOrder(), null);

The "0" in the return statement should have been "offsetBytes". I checked the similar classes WritableMemory, Buffer and WritableBuffer for a similar error and they were all OK. This fix includes a test for this bug.

When approved this will be merged into branch master. From there I will cherry-pick this commit into 2.2.X branch in preparation for a bug fix release 2.2.1.