mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-10 10:11:31 +00:00
Fixed Array.Copy.
This commit is contained in:
parent
a12e7ff875
commit
3b6cade435
2 changed files with 19 additions and 10 deletions
|
|
@ -38,12 +38,28 @@ namespace Cosmos.Compiler.Tests.Bcl.System.Collections.Generic
|
|||
Assert.AreEqual(1, xList[2], "List<int>.Insert: xList[2] != 1");
|
||||
Assert.AreEqual(2, xList[3], "List<int>.Insert: xList[3] != 2");
|
||||
|
||||
xList.Insert(0, 7);
|
||||
|
||||
Assert.AreEqual(7, xList[0], "List<int>.Insert: xList[0] != 7");
|
||||
Assert.AreEqual(0, xList[1], "List<int>.Insert: xList[1] != 0");
|
||||
Assert.AreEqual(5, xList[2], "List<int>.Insert: xList[2] != 5");
|
||||
Assert.AreEqual(1, xList[3], "List<int>.Insert: xList[3] != 1");
|
||||
Assert.AreEqual(2, xList[4], "List<int>.Insert: xList[4] != 2");
|
||||
|
||||
xList.RemoveAt(2);
|
||||
|
||||
Assert.AreEqual(7, xList[0], "List<int>.RemoveAt: xList[0] != 7");
|
||||
Assert.AreEqual(0, xList[1], "List<int>.RemoveAt: xList[1] != 0");
|
||||
Assert.AreEqual(1, xList[2], "List<int>.RemoveAt: xList[2] != 1");
|
||||
Assert.AreEqual(2, xList[3], "List<int>.RemoveAt: xList[3] != 2");
|
||||
|
||||
xList.RemoveAt(0);
|
||||
|
||||
Assert.AreEqual(0, xList[0], "List<int>.RemoveAt: xList[0] != 0");
|
||||
Assert.AreEqual(5, xList[1], "List<int>.RemoveAt: xList[1] != 5");
|
||||
Assert.AreEqual(1, xList[1], "List<int>.RemoveAt: xList[1] != 1");
|
||||
Assert.AreEqual(2, xList[2], "List<int>.RemoveAt: xList[2] != 2");
|
||||
|
||||
|
||||
// Commented tests depend on #583
|
||||
|
||||
//xList.AddRange(new List<int>() { 3, 4, 5 });
|
||||
|
|
|
|||
|
|
@ -71,22 +71,15 @@ namespace Cosmos.Core_Asm
|
|||
XS.Multiply(EDX);
|
||||
XS.Set(ECX, EAX);
|
||||
|
||||
// if source and destination are equal, jump to end
|
||||
XS.Set(EAX, ESI);
|
||||
XS.Add(EAX, ECX);
|
||||
XS.Compare(EDI, EAX);
|
||||
XS.Jump(ConditionalTestEnum.Equal, xArrayCopyEndLabel);
|
||||
XS.Jump(ConditionalTestEnum.LessThanOrEqualTo, xArrayCopyReverseLabel);
|
||||
XS.Compare(EDI, ESI);
|
||||
XS.Jump(ConditionalTestEnum.GreaterThan, xArrayCopyReverseLabel);
|
||||
|
||||
new Movs { Size = 8, Prefixes = InstructionPrefixes.Repeat };
|
||||
|
||||
XS.Jump(xArrayCopyEndLabel);
|
||||
|
||||
// source ptr + size >= destination ptr
|
||||
XS.Label(xArrayCopyReverseLabel);
|
||||
|
||||
XS.Comment("Array Reverse Copy: source ptr + size >= destination ptr");
|
||||
|
||||
XS.Add(ESI, ECX);
|
||||
XS.Add(EDI, ECX);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue