File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Src/StackMemoryCollections Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -1051,7 +1051,12 @@ bool calculateSize
10511051 builder . Append ( $@ "
10521052 public void Copy(in Class.StackOf{ typeof ( T ) . Name } destStack)
10531053 {{
1054- if (destStack.Capacity < Capacity)
1054+ if(Size == 0)
1055+ {{
1056+ return;
1057+ }}
1058+
1059+ if (destStack.Capacity < Size)
10551060 {{
10561061 throw new ArgumentException(""Destination stack not enough capacity"");
10571062 }}
@@ -1060,7 +1065,7 @@ public void Copy(in Class.StackOf{typeof(T).Name} destStack)
10601065 _start,
10611066 destStack.Start,
10621067 destStack.Capacity * { ( calculateSize ? $ "(nuint)sizeof({ typeof ( T ) . Name } )" : ( sizeOf ) . ToString ( ) ) } ,
1063- Capacity * { ( calculateSize ? $ "(nuint)sizeof({ typeof ( T ) . Name } )" : ( sizeOf ) . ToString ( ) ) }
1068+ Size * { ( calculateSize ? $ "(nuint)sizeof({ typeof ( T ) . Name } )" : ( sizeOf ) . ToString ( ) ) }
10641069 );
10651070
10661071 destStack.Size = Size;
Original file line number Diff line number Diff line change @@ -1070,7 +1070,12 @@ in string sizeOfStr
10701070 builder . Append ( $@ "
10711071 public void Copy(in { currentType . ContainingNamespace } .Class.StackOf{ currentType . Name } destStack)
10721072 {{
1073- if (destStack.Capacity < Capacity)
1073+ if(Size == 0)
1074+ {{
1075+ return;
1076+ }}
1077+
1078+ if (destStack.Capacity < Size)
10741079 {{
10751080 throw new ArgumentException(""Destination stack not enough capacity"");
10761081 }}
@@ -1079,7 +1084,7 @@ public void Copy(in {currentType.ContainingNamespace}.Class.StackOf{currentType.
10791084 _start,
10801085 destStack.Start,
10811086 destStack.Capacity * { sizeOfStr } ,
1082- Capacity * { sizeOfStr }
1087+ Size * { sizeOfStr }
10831088 );
10841089
10851090 destStack.Size = Size;
You can’t perform that action at this time.
0 commit comments