@@ -420,7 +420,7 @@ public static unsafe void AddScalarU(float scalar, Span<float> dst)
420
420
421
421
Vector256 < float > scalarVector256 = Avx . SetAllVector256 ( scalar ) ;
422
422
423
- while ( pDstCurrent + 8 <= pDstEnd )
423
+ while ( pDstEnd - pDstCurrent >= 8 )
424
424
{
425
425
Vector256 < float > dstVector = Avx . LoadVector256 ( pDstCurrent ) ;
426
426
dstVector = Avx . Add ( dstVector , scalarVector256 ) ;
@@ -431,7 +431,7 @@ public static unsafe void AddScalarU(float scalar, Span<float> dst)
431
431
432
432
Vector128 < float > scalarVector128 = Sse . SetAllVector128 ( scalar ) ;
433
433
434
- if ( pDstCurrent + 4 <= pDstEnd )
434
+ if ( pDstEnd - pDstCurrent >= 4 )
435
435
{
436
436
Vector128 < float > dstVector = Sse . LoadVector128 ( pDstCurrent ) ;
437
437
dstVector = Sse . Add ( dstVector , scalarVector128 ) ;
@@ -460,7 +460,7 @@ public static unsafe void ScaleU(float scale, Span<float> dst)
460
460
461
461
Vector256 < float > scaleVector256 = Avx . SetAllVector256 ( scale ) ;
462
462
463
- while ( pDstCurrent + 8 <= pEnd )
463
+ while ( pEnd - pDstCurrent >= 8 )
464
464
{
465
465
Vector256 < float > dstVector = Avx . LoadVector256 ( pDstCurrent ) ;
466
466
@@ -472,7 +472,7 @@ public static unsafe void ScaleU(float scale, Span<float> dst)
472
472
473
473
Vector128 < float > scaleVector128 = Sse . SetAllVector128 ( scale ) ;
474
474
475
- if ( pDstCurrent + 4 <= pEnd )
475
+ if ( pEnd - pDstCurrent >= 4 )
476
476
{
477
477
Vector128 < float > dstVector = Sse . LoadVector128 ( pDstCurrent ) ;
478
478
@@ -505,7 +505,7 @@ public static unsafe void ScaleSrcU(float scale, Span<float> src, Span<float> ds
505
505
506
506
Vector256 < float > scaleVector256 = Avx . SetAllVector256 ( scale ) ;
507
507
508
- while ( pDstCurrent + 8 <= pDstEnd )
508
+ while ( pDstEnd - pDstCurrent >= 8 )
509
509
{
510
510
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
511
511
srcVector = Avx . Multiply ( srcVector , scaleVector256 ) ;
@@ -517,7 +517,7 @@ public static unsafe void ScaleSrcU(float scale, Span<float> src, Span<float> ds
517
517
518
518
Vector128 < float > scaleVector128 = Sse . SetAllVector128 ( scale ) ;
519
519
520
- if ( pDstCurrent + 4 <= pDstEnd )
520
+ if ( pDstEnd - pDstCurrent >= 4 )
521
521
{
522
522
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
523
523
srcVector = Sse . Multiply ( srcVector , scaleVector128 ) ;
@@ -550,7 +550,7 @@ public static unsafe void ScaleAddU(float a, float b, Span<float> dst)
550
550
Vector256 < float > a256 = Avx . SetAllVector256 ( a ) ;
551
551
Vector256 < float > b256 = Avx . SetAllVector256 ( b ) ;
552
552
553
- while ( pDstCurrent + 8 <= pDstEnd )
553
+ while ( pDstEnd - pDstCurrent >= 8 )
554
554
{
555
555
Vector256 < float > dstVector = Avx . LoadVector256 ( pDstCurrent ) ;
556
556
dstVector = Avx . Add ( dstVector , b256 ) ;
@@ -563,7 +563,7 @@ public static unsafe void ScaleAddU(float a, float b, Span<float> dst)
563
563
Vector128 < float > a128 = Sse . SetAllVector128 ( a ) ;
564
564
Vector128 < float > b128 = Sse . SetAllVector128 ( b ) ;
565
565
566
- if ( pDstCurrent + 4 <= pDstEnd )
566
+ if ( pDstEnd - pDstCurrent >= 4 )
567
567
{
568
568
Vector128 < float > dstVector = Sse . LoadVector128 ( pDstCurrent ) ;
569
569
dstVector = Sse . Add ( dstVector , b128 ) ;
@@ -596,7 +596,7 @@ public static unsafe void AddScaleU(float scale, Span<float> src, Span<float> ds
596
596
597
597
Vector256 < float > scaleVector256 = Avx . SetAllVector256 ( scale ) ;
598
598
599
- while ( pDstCurrent + 8 <= pEnd )
599
+ while ( pEnd - pDstCurrent >= 8 )
600
600
{
601
601
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
602
602
Vector256 < float > dstVector = Avx . LoadVector256 ( pDstCurrent ) ;
@@ -611,7 +611,7 @@ public static unsafe void AddScaleU(float scale, Span<float> src, Span<float> ds
611
611
612
612
Vector128 < float > scaleVector128 = Sse . SetAllVector128 ( scale ) ;
613
613
614
- if ( pDstCurrent + 4 <= pEnd )
614
+ if ( pEnd - pDstCurrent >= 4 )
615
615
{
616
616
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
617
617
Vector128 < float > dstVector = Sse . LoadVector128 ( pDstCurrent ) ;
@@ -652,7 +652,7 @@ public static unsafe void AddScaleCopyU(float scale, Span<float> src, Span<float
652
652
653
653
Vector256 < float > scaleVector256 = Avx . SetAllVector256 ( scale ) ;
654
654
655
- while ( pResCurrent + 8 <= pResEnd )
655
+ while ( pResEnd - pResCurrent >= 8 )
656
656
{
657
657
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
658
658
Vector256 < float > dstVector = Avx . LoadVector256 ( pDstCurrent ) ;
@@ -667,7 +667,7 @@ public static unsafe void AddScaleCopyU(float scale, Span<float> src, Span<float
667
667
668
668
Vector128 < float > scaleVector128 = Sse . SetAllVector128 ( scale ) ;
669
669
670
- if ( pResCurrent + 4 <= pResEnd )
670
+ if ( pResEnd - pResCurrent >= 4 )
671
671
{
672
672
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
673
673
Vector128 < float > dstVector = Sse . LoadVector128 ( pDstCurrent ) ;
@@ -708,7 +708,7 @@ public static unsafe void AddScaleSU(float scale, Span<float> src, Span<int> idx
708
708
709
709
Vector256 < float > scaleVector256 = Avx . SetAllVector256 ( scale ) ;
710
710
711
- while ( pIdxCurrent + 8 <= pEnd )
711
+ while ( pEnd - pIdxCurrent >= 8 )
712
712
{
713
713
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
714
714
Vector256 < float > dstVector = Load8 ( pDstCurrent , pIdxCurrent ) ;
@@ -723,7 +723,7 @@ public static unsafe void AddScaleSU(float scale, Span<float> src, Span<int> idx
723
723
724
724
Vector128 < float > scaleVector128 = Sse . SetAllVector128 ( scale ) ;
725
725
726
- if ( pIdxCurrent + 4 <= pEnd )
726
+ if ( pEnd - pIdxCurrent >= 4 )
727
727
{
728
728
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
729
729
Vector128 < float > dstVector = SseIntrinsics . Load4 ( pDstCurrent , pIdxCurrent ) ;
@@ -755,7 +755,7 @@ public static unsafe void AddU(Span<float> src, Span<float> dst)
755
755
float * pDstCurrent = pdst ;
756
756
float * pEnd = psrc + src . Length ;
757
757
758
- while ( pSrcCurrent + 8 <= pEnd )
758
+ while ( pEnd - pSrcCurrent >= 8 )
759
759
{
760
760
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
761
761
Vector256 < float > dstVector = Avx . LoadVector256 ( pDstCurrent ) ;
@@ -767,7 +767,7 @@ public static unsafe void AddU(Span<float> src, Span<float> dst)
767
767
pDstCurrent += 8 ;
768
768
}
769
769
770
- if ( pSrcCurrent + 4 <= pEnd )
770
+ if ( pEnd - pSrcCurrent >= 4 )
771
771
{
772
772
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
773
773
Vector128 < float > dstVector = Sse . LoadVector128 ( pDstCurrent ) ;
@@ -804,7 +804,7 @@ public static unsafe void AddSU(Span<float> src, Span<int> idx, Span<float> dst)
804
804
float * pDstCurrent = pdst ;
805
805
int * pEnd = pidx + idx . Length ;
806
806
807
- while ( pIdxCurrent + 8 <= pEnd )
807
+ while ( pEnd - pIdxCurrent >= 8 )
808
808
{
809
809
Vector256 < float > dstVector = Load8 ( pDstCurrent , pIdxCurrent ) ;
810
810
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
@@ -816,7 +816,7 @@ public static unsafe void AddSU(Span<float> src, Span<int> idx, Span<float> dst)
816
816
pSrcCurrent += 8 ;
817
817
}
818
818
819
- if ( pIdxCurrent + 4 <= pEnd )
819
+ if ( pEnd - pIdxCurrent >= 4 )
820
820
{
821
821
Vector128 < float > dstVector = SseIntrinsics . Load4 ( pDstCurrent , pIdxCurrent ) ;
822
822
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
@@ -849,7 +849,7 @@ public static unsafe void MulElementWiseU(Span<float> src1, Span<float> src2, Sp
849
849
float * pDstCurrent = pdst ;
850
850
float * pEnd = pdst + dst . Length ;
851
851
852
- while ( pDstCurrent + 8 <= pEnd )
852
+ while ( pEnd - pDstCurrent >= 8 )
853
853
{
854
854
Vector256 < float > src1Vector = Avx . LoadVector256 ( pSrc1Current ) ;
855
855
Vector256 < float > src2Vector = Avx . LoadVector256 ( pSrc2Current ) ;
@@ -861,7 +861,7 @@ public static unsafe void MulElementWiseU(Span<float> src1, Span<float> src2, Sp
861
861
pDstCurrent += 8 ;
862
862
}
863
863
864
- if ( pDstCurrent + 4 <= pEnd )
864
+ if ( pEnd - pDstCurrent >= 4 )
865
865
{
866
866
Vector128 < float > src1Vector = Sse . LoadVector128 ( pSrc1Current ) ;
867
867
Vector128 < float > src2Vector = Sse . LoadVector128 ( pSrc2Current ) ;
@@ -896,7 +896,7 @@ public static unsafe float SumU(Span<float> src)
896
896
897
897
Vector256 < float > result256 = Avx . SetZeroVector256 < float > ( ) ;
898
898
899
- while ( pSrcCurrent + 8 <= pSrcEnd )
899
+ while ( pSrcEnd - pSrcCurrent >= 8 )
900
900
{
901
901
result256 = Avx . Add ( result256 , Avx . LoadVector256 ( pSrcCurrent ) ) ;
902
902
pSrcCurrent += 8 ;
@@ -907,7 +907,7 @@ public static unsafe float SumU(Span<float> src)
907
907
908
908
Vector128 < float > result128 = Sse . SetZeroVector128 ( ) ;
909
909
910
- if ( pSrcCurrent + 4 <= pSrcEnd )
910
+ if ( pSrcEnd - pSrcCurrent >= 4 )
911
911
{
912
912
result128 = Sse . Add ( result128 , Sse . LoadVector128 ( pSrcCurrent ) ) ;
913
913
pSrcCurrent += 4 ;
@@ -934,7 +934,7 @@ public static unsafe float SumSqU(Span<float> src)
934
934
935
935
Vector256 < float > result256 = Avx . SetZeroVector256 < float > ( ) ;
936
936
937
- while ( pSrcCurrent + 8 <= pSrcEnd )
937
+ while ( pSrcEnd - pSrcCurrent >= 8 )
938
938
{
939
939
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
940
940
result256 = Avx . Add ( result256 , Avx . Multiply ( srcVector , srcVector ) ) ;
@@ -947,7 +947,7 @@ public static unsafe float SumSqU(Span<float> src)
947
947
948
948
Vector128 < float > result128 = Sse . SetZeroVector128 ( ) ;
949
949
950
- if ( pSrcCurrent + 4 <= pSrcEnd )
950
+ if ( pSrcEnd - pSrcCurrent >= 4 )
951
951
{
952
952
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
953
953
result128 = Sse . Add ( result128 , Sse . Multiply ( srcVector , srcVector ) ) ;
@@ -979,7 +979,7 @@ public static unsafe float SumSqDiffU(float mean, Span<float> src)
979
979
Vector256 < float > result256 = Avx . SetZeroVector256 < float > ( ) ;
980
980
Vector256 < float > meanVector256 = Avx . SetAllVector256 ( mean ) ;
981
981
982
- while ( pSrcCurrent + 8 <= pSrcEnd )
982
+ while ( pSrcEnd - pSrcCurrent >= 8 )
983
983
{
984
984
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
985
985
srcVector = Avx . Subtract ( srcVector , meanVector256 ) ;
@@ -994,7 +994,7 @@ public static unsafe float SumSqDiffU(float mean, Span<float> src)
994
994
Vector128 < float > result128 = Sse . SetZeroVector128 ( ) ;
995
995
Vector128 < float > meanVector128 = Sse . SetAllVector128 ( mean ) ;
996
996
997
- if ( pSrcCurrent + 4 <= pSrcEnd )
997
+ if ( pSrcEnd - pSrcCurrent >= 4 )
998
998
{
999
999
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
1000
1000
srcVector = Sse . Subtract ( srcVector , meanVector128 ) ;
@@ -1027,7 +1027,7 @@ public static unsafe float SumAbsU(Span<float> src)
1027
1027
1028
1028
Vector256 < float > result256 = Avx . SetZeroVector256 < float > ( ) ;
1029
1029
1030
- while ( pSrcCurrent + 8 <= pSrcEnd )
1030
+ while ( pSrcEnd - pSrcCurrent >= 8 )
1031
1031
{
1032
1032
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
1033
1033
result256 = Avx . Add ( result256 , Avx . And ( srcVector , _absMask256 ) ) ;
@@ -1040,7 +1040,7 @@ public static unsafe float SumAbsU(Span<float> src)
1040
1040
1041
1041
Vector128 < float > result128 = Sse . SetZeroVector128 ( ) ;
1042
1042
1043
- if ( pSrcCurrent + 4 <= pSrcEnd )
1043
+ if ( pSrcEnd - pSrcCurrent >= 4 )
1044
1044
{
1045
1045
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
1046
1046
result128 = Sse . Add ( result128 , Sse . And ( srcVector , SseIntrinsics . AbsMask128 ) ) ;
@@ -1072,7 +1072,7 @@ public static unsafe float SumAbsDiffU(float mean, Span<float> src)
1072
1072
Vector256 < float > result256 = Avx . SetZeroVector256 < float > ( ) ;
1073
1073
Vector256 < float > meanVector256 = Avx . SetAllVector256 ( mean ) ;
1074
1074
1075
- while ( pSrcCurrent + 8 <= pSrcEnd )
1075
+ while ( pSrcEnd - pSrcCurrent >= 8 )
1076
1076
{
1077
1077
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
1078
1078
srcVector = Avx . Subtract ( srcVector , meanVector256 ) ;
@@ -1087,7 +1087,7 @@ public static unsafe float SumAbsDiffU(float mean, Span<float> src)
1087
1087
Vector128 < float > result128 = Sse . SetZeroVector128 ( ) ;
1088
1088
Vector128 < float > meanVector128 = Sse . SetAllVector128 ( mean ) ;
1089
1089
1090
- if ( pSrcCurrent + 4 <= pSrcEnd )
1090
+ if ( pSrcEnd - pSrcCurrent >= 4 )
1091
1091
{
1092
1092
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
1093
1093
srcVector = Sse . Subtract ( srcVector , meanVector128 ) ;
@@ -1120,7 +1120,7 @@ public static unsafe float MaxAbsU(Span<float> src)
1120
1120
1121
1121
Vector256 < float > result256 = Avx . SetZeroVector256 < float > ( ) ;
1122
1122
1123
- while ( pSrcCurrent + 8 <= pSrcEnd )
1123
+ while ( pSrcEnd - pSrcCurrent >= 8 )
1124
1124
{
1125
1125
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
1126
1126
result256 = Avx . Max ( result256 , Avx . And ( srcVector , _absMask256 ) ) ;
@@ -1133,7 +1133,7 @@ public static unsafe float MaxAbsU(Span<float> src)
1133
1133
1134
1134
Vector128 < float > result128 = Sse . SetZeroVector128 ( ) ;
1135
1135
1136
- if ( pSrcCurrent + 4 <= pSrcEnd )
1136
+ if ( pSrcEnd - pSrcCurrent >= 4 )
1137
1137
{
1138
1138
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
1139
1139
result128 = Sse . Max ( result128 , Sse . And ( srcVector , SseIntrinsics . AbsMask128 ) ) ;
@@ -1165,7 +1165,7 @@ public static unsafe float MaxAbsDiffU(float mean, Span<float> src)
1165
1165
Vector256 < float > result256 = Avx . SetZeroVector256 < float > ( ) ;
1166
1166
Vector256 < float > meanVector256 = Avx . SetAllVector256 ( mean ) ;
1167
1167
1168
- while ( pSrcCurrent + 8 <= pSrcEnd )
1168
+ while ( pSrcEnd - pSrcCurrent >= 8 )
1169
1169
{
1170
1170
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
1171
1171
srcVector = Avx . Subtract ( srcVector , meanVector256 ) ;
@@ -1180,7 +1180,7 @@ public static unsafe float MaxAbsDiffU(float mean, Span<float> src)
1180
1180
Vector128 < float > result128 = Sse . SetZeroVector128 ( ) ;
1181
1181
Vector128 < float > meanVector128 = Sse . SetAllVector128 ( mean ) ;
1182
1182
1183
- if ( pSrcCurrent + 4 <= pSrcEnd )
1183
+ if ( pSrcEnd - pSrcCurrent >= 4 )
1184
1184
{
1185
1185
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
1186
1186
srcVector = Sse . Subtract ( srcVector , meanVector128 ) ;
@@ -1215,7 +1215,7 @@ public static unsafe float DotU(Span<float> src, Span<float> dst)
1215
1215
1216
1216
Vector256 < float > result256 = Avx . SetZeroVector256 < float > ( ) ;
1217
1217
1218
- while ( pSrcCurrent + 8 <= pSrcEnd )
1218
+ while ( pSrcEnd - pSrcCurrent >= 8 )
1219
1219
{
1220
1220
Vector256 < float > srcVector = Avx . LoadVector256 ( pSrcCurrent ) ;
1221
1221
Vector256 < float > dstVector = Avx . LoadVector256 ( pDstCurrent ) ;
@@ -1231,7 +1231,7 @@ public static unsafe float DotU(Span<float> src, Span<float> dst)
1231
1231
1232
1232
Vector128 < float > result128 = Sse . SetZeroVector128 ( ) ;
1233
1233
1234
- if ( pSrcCurrent + 4 <= pSrcEnd )
1234
+ if ( pSrcEnd - pSrcCurrent >= 4 )
1235
1235
{
1236
1236
Vector128 < float > srcVector = Sse . LoadVector128 ( pSrcCurrent ) ;
1237
1237
Vector128 < float > dstVector = Sse . LoadVector128 ( pDstCurrent ) ;
@@ -1272,7 +1272,7 @@ public static unsafe float DotSU(Span<float> src, Span<float> dst, Span<int> idx
1272
1272
1273
1273
Vector256 < float > result256 = Avx . SetZeroVector256 < float > ( ) ;
1274
1274
1275
- while ( pIdxCurrent + 8 <= pIdxEnd )
1275
+ while ( pIdxEnd - pIdxCurrent >= 8 )
1276
1276
{
1277
1277
Vector256 < float > srcVector = Load8 ( pSrcCurrent , pIdxCurrent ) ;
1278
1278
Vector256 < float > dstVector = Avx . LoadVector256 ( pDstCurrent ) ;
@@ -1288,7 +1288,7 @@ public static unsafe float DotSU(Span<float> src, Span<float> dst, Span<int> idx
1288
1288
1289
1289
Vector128 < float > result128 = Sse . SetZeroVector128 ( ) ;
1290
1290
1291
- if ( pIdxCurrent + 4 <= pIdxEnd )
1291
+ if ( pIdxEnd - pIdxCurrent >= 4 )
1292
1292
{
1293
1293
Vector128 < float > srcVector = SseIntrinsics . Load4 ( pSrcCurrent , pIdxCurrent ) ;
1294
1294
Vector128 < float > dstVector = Sse . LoadVector128 ( pDstCurrent ) ;
@@ -1327,7 +1327,7 @@ public static unsafe float Dist2(Span<float> src, Span<float> dst)
1327
1327
1328
1328
Vector256 < float > sqDistanceVector256 = Avx . SetZeroVector256 < float > ( ) ;
1329
1329
1330
- while ( pSrcCurrent + 8 <= pSrcEnd )
1330
+ while ( pSrcEnd - pSrcCurrent >= 8 )
1331
1331
{
1332
1332
Vector256 < float > distanceVector = Avx . Subtract ( Avx . LoadVector256 ( pSrcCurrent ) ,
1333
1333
Avx . LoadVector256 ( pDstCurrent ) ) ;
@@ -1343,7 +1343,7 @@ public static unsafe float Dist2(Span<float> src, Span<float> dst)
1343
1343
1344
1344
Vector128 < float > sqDistanceVector128 = Sse . SetZeroVector128 ( ) ;
1345
1345
1346
- if ( pSrcCurrent + 4 <= pSrcEnd )
1346
+ if ( pSrcEnd - pSrcCurrent >= 4 )
1347
1347
{
1348
1348
Vector128 < float > distanceVector = Sse . Subtract ( Sse . LoadVector128 ( pSrcCurrent ) ,
1349
1349
Sse . LoadVector128 ( pDstCurrent ) ) ;
@@ -1384,7 +1384,7 @@ public static unsafe void SdcaL1UpdateU(float primalUpdate, Span<float> src, flo
1384
1384
Vector256 < float > xPrimal256 = Avx . SetAllVector256 ( primalUpdate ) ;
1385
1385
Vector256 < float > xThreshold256 = Avx . SetAllVector256 ( threshold ) ;
1386
1386
1387
- while ( pSrcCurrent + 8 <= pSrcEnd )
1387
+ while ( pSrcEnd - pSrcCurrent >= 8 )
1388
1388
{
1389
1389
Vector256 < float > xSrc = Avx . LoadVector256 ( pSrcCurrent ) ;
1390
1390
@@ -1403,7 +1403,7 @@ public static unsafe void SdcaL1UpdateU(float primalUpdate, Span<float> src, flo
1403
1403
Vector128 < float > xPrimal128 = Sse . SetAllVector128 ( primalUpdate ) ;
1404
1404
Vector128 < float > xThreshold128 = Sse . SetAllVector128 ( threshold ) ;
1405
1405
1406
- if ( pSrcCurrent + 4 <= pSrcEnd )
1406
+ if ( pSrcEnd - pSrcCurrent >= 4 )
1407
1407
{
1408
1408
Vector128 < float > xSrc = Sse . LoadVector128 ( pSrcCurrent ) ;
1409
1409
@@ -1446,7 +1446,7 @@ public static unsafe void SdcaL1UpdateSU(float primalUpdate, Span<float> src, Sp
1446
1446
Vector256 < float > xPrimal256 = Avx . SetAllVector256 ( primalUpdate ) ;
1447
1447
Vector256 < float > xThreshold = Avx . SetAllVector256 ( threshold ) ;
1448
1448
1449
- while ( pIdxCurrent + 8 <= pIdxEnd )
1449
+ while ( pIdxEnd - pIdxCurrent >= 8 )
1450
1450
{
1451
1451
Vector256 < float > xSrc = Avx . LoadVector256 ( pSrcCurrent ) ;
1452
1452
@@ -1464,7 +1464,7 @@ public static unsafe void SdcaL1UpdateSU(float primalUpdate, Span<float> src, Sp
1464
1464
Vector128 < float > xPrimal128 = Sse . SetAllVector128 ( primalUpdate ) ;
1465
1465
Vector128 < float > xThreshold128 = Sse . SetAllVector128 ( threshold ) ;
1466
1466
1467
- if ( pIdxCurrent + 4 <= pIdxEnd )
1467
+ if ( pIdxEnd - pIdxCurrent >= 4 )
1468
1468
{
1469
1469
Vector128 < float > xSrc = Sse . LoadVector128 ( pSrcCurrent ) ;
1470
1470
0 commit comments