1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-20 08:58:00 +02:00

^ From End index is relative to length instead of length-1

This commit is contained in:
Brian Fiete 2021-10-26 06:15:36 -07:00
parent fa3198f82a
commit 299bea0eaa
6 changed files with 30 additions and 27 deletions

View file

@ -269,7 +269,7 @@ namespace System
switch (index)
{
case .FromFront(let offset): idx = offset;
case .FromEnd(let offset): idx = mLength - 1 - offset;
case .FromEnd(let offset): idx = mLength - offset;
}
if ((uint)idx >= (uint)mLength)
Internal.ThrowIndexOutOfRange(1);
@ -283,7 +283,7 @@ namespace System
switch (index)
{
case .FromFront(let offset): idx = offset;
case .FromEnd(let offset): idx = mLength - 1 - offset;
case .FromEnd(let offset): idx = mLength - offset;
}
return ref (&mFirstElement)[idx];
}