@@ -853,9 +853,9 @@ public static int Score(QRCodeData qrCode)
853
853
854
854
//Penalty 4
855
855
int blackModules = 0 ;
856
- foreach ( var row in qrCode . ModuleMatrix )
857
- foreach ( bool bit in row )
858
- if ( bit )
856
+ foreach ( var bitArray in qrCode . ModuleMatrix )
857
+ for ( var x = 0 ; x < size ; x ++ )
858
+ if ( bitArray [ x ] )
859
859
blackModules ++ ;
860
860
861
861
var percentDiv5 = blackModules * 20 / ( qrCode . ModuleMatrix . Count * qrCode . ModuleMatrix . Count ) ;
@@ -1311,7 +1311,7 @@ private static Polynom MultiplyAlphaPolynoms(Polynom polynomBase, Polynom polyno
1311
1311
1312
1312
int [ ] GetNotUniqueExponents ( List < PolynomItem > list )
1313
1313
{
1314
- var dic = new Dictionary < int , bool > ( ) ;
1314
+ var dic = new Dictionary < int , bool > ( list . Count ) ;
1315
1315
foreach ( var row in list )
1316
1316
{
1317
1317
#if NETCOREAPP
@@ -1385,7 +1385,7 @@ private static Dictionary<int, AlignmentPattern> CreateAlignmentPatternTable()
1385
1385
1386
1386
for ( var i = 0 ; i < ( 7 * 40 ) ; i = i + 7 )
1387
1387
{
1388
- var points = new List < Point > ( ) ;
1388
+ var points = new List < Point > ( 50 ) ;
1389
1389
for ( var x = 0 ; x < 7 ; x ++ )
1390
1390
{
1391
1391
if ( alignmentPatternBaseValues [ i + x ] != 0 )
@@ -1654,7 +1654,7 @@ public override string ToString()
1654
1654
}
1655
1655
}
1656
1656
1657
- private readonly struct Point
1657
+ private readonly struct Point : IEquatable < Point >
1658
1658
{
1659
1659
public int X { get ; }
1660
1660
public int Y { get ; }
@@ -1663,6 +1663,12 @@ public Point(int x, int y)
1663
1663
this . X = x ;
1664
1664
this . Y = y ;
1665
1665
}
1666
+
1667
+ public bool Equals ( Point other )
1668
+ {
1669
+ return this . X == other . X && this . Y == other . Y ;
1670
+ }
1671
+
1666
1672
}
1667
1673
1668
1674
private readonly struct Rectangle
0 commit comments