mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(index) Use MemorySegment.copy for LongArray->LongArray transfers
This commit is contained in:
parent
b95646625f
commit
9f9c6736ab
@ -182,9 +182,11 @@ public class SegmentLongArray implements LongArray {
|
||||
if (destEndL > size())
|
||||
throw new IndexOutOfBoundsException("Destination array too small");
|
||||
|
||||
for (long i = destStartL; i < destEndL; i++) {
|
||||
set(i, source.get(sourceStartL + i - destStartL));
|
||||
}
|
||||
MemorySegment.copy(
|
||||
source.getMemorySegment(), JAVA_LONG, sourceStartL,
|
||||
segment, JAVA_LONG, destStartL,
|
||||
destEndL - destStartL
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -283,9 +283,11 @@ public class UnsafeLongArray implements LongArray {
|
||||
if (destEndL > size())
|
||||
throw new IndexOutOfBoundsException("Destination array too small");
|
||||
|
||||
for (long i = destStartL; i < destEndL; i++) {
|
||||
set(i, source.get(sourceStartL + i - destStartL));
|
||||
}
|
||||
MemorySegment.copy(
|
||||
source.getMemorySegment(), JAVA_LONG, sourceStartL,
|
||||
segment, JAVA_LONG, destStartL,
|
||||
destEndL - destStartL
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user