Skip to content

Commit

Permalink
Address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsonkhan committed Jan 20, 2018
1 parent a4c639f commit 94e3346
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Common/tests/System/Buffers/NativeOwnedMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override bool IsRetained

public override unsafe MemoryHandle Pin(int offset = 0)
{
if (offset < 0 || (_length > 0 && offset >= _length)) throw new ArgumentOutOfRangeException(nameof(offset));
if (offset < 0 || offset > _length) throw new ArgumentOutOfRangeException(nameof(offset));
void* pointer = (void*)((byte*)_ptr + offset);
return new MemoryHandle(this, pointer);
}
Expand Down
2 changes: 1 addition & 1 deletion src/System.Memory/tests/Memory/CustomMemoryForTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public override MemoryHandle Pin(int offset = 0)
unsafe
{
Retain();
if (offset < 0 || (_array.Length > 0 && offset >= _array.Length)) throw new ArgumentOutOfRangeException(nameof(offset));
if (offset < 0 || offset > _array.Length) throw new ArgumentOutOfRangeException(nameof(offset));
var handle = GCHandle.Alloc(_array, GCHandleType.Pinned);
return new MemoryHandle(this, Unsafe.Add<byte>((void*)handle.AddrOfPinnedObject(), offset), handle);
}
Expand Down

0 comments on commit 94e3346

Please sign in to comment.