Skip to content

Commit

Permalink
minor fixes in fill
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHegarty committed May 13, 2020
1 parent f0e10f6 commit e66ab85
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ static <S extends MemorySegment> Spliterator<S> spliterator(S segment, SequenceL
* for (long l = 0; l < segment.byteSize(); l++) {
* byteHandle.set(segment.baseAddress(), l, value);
* }</pre></blockquote>
* without any regard or guarantees on the ordering of particular memory
* elements being set.
* <p>
* Fill can be useful to initialize or reset the memory of a segment.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,7 @@ public static <S extends MemorySegment> Spliterator<S> spliterator(S segment, Se

public static void fill(MemorySegment segment, byte value) {
AbstractMemorySegmentImpl segmentImpl = (AbstractMemorySegmentImpl) segment;
segmentImpl.checkValidState();
if (!segmentImpl.isSet(WRITE)) {
throw segmentImpl.unsupportedAccessMode(WRITE);
}
segmentImpl.checkRange(0, segmentImpl.length, true);
UNSAFE.setMemory(segmentImpl.base(), segmentImpl.min(), segmentImpl.length, value);
}

Expand Down

0 comments on commit e66ab85

Please sign in to comment.