Skip to content

Commit 18a45ca

Browse files
committed
+ fix Vector Exception
1 parent 1631188 commit 18a45ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Geopack/Geopack.Recalc.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,7 @@ private static (double[] G, double[] H) Interpolate(
237237
int vectorSize = Vector<double>.Count;
238238

239239
int i = 0;
240-
241-
for (; i <= GeopackConstants.IgrfCoefficientCount - vectorSize; i += vectorSize)
240+
while (GeopackConstants.IgrfCoefficientCount - i >= vectorSize)
242241
{
243242
Vector<double> vG1 = new(G1, i);
244243
Vector<double> vG2 = new(G2, i);
@@ -247,6 +246,8 @@ private static (double[] G, double[] H) Interpolate(
247246

248247
(vG1 * vF1 + vG2 * vF2).CopyTo(G, i);
249248
(vH1 * vF1 + vH2 * vF2).CopyTo(H, i);
249+
250+
i += vectorSize;
250251
}
251252

252253
if (i >= GeopackConstants.IgrfCoefficientCount)

0 commit comments

Comments
 (0)