@@ -29,7 +29,6 @@ internal static StringProperties GetStringProperties(string[] keys, bool enableT
2929
3030 //We need to know the longest string for optimal mixing. Probably not 100% necessary.
3131 string maxStr = keys [ 0 ] ;
32- int minLength = int . MaxValue ;
3332 int minUtf8ByteLength = int . MaxValue ;
3433 int maxUtf8ByteLength = int . MinValue ;
3534 int minUtf16ByteLength = int . MaxValue ;
@@ -50,7 +49,6 @@ internal static StringProperties GetStringProperties(string[] keys, bool enableT
5049 minUtf16ByteLength = Math . Min ( utf16ByteCount , minUtf16ByteLength ) ;
5150 maxUtf16ByteLength = Math . Max ( utf16ByteCount , maxUtf16ByteLength ) ;
5251
53- minLength = Math . Min ( minLength , str . Length ) ; //Track the smallest string. It might be more than what lengthmap supports
5452 uniq &= ! lengthMap . SetTrue ( str . Length ) ;
5553
5654 foreach ( char c in str )
@@ -70,7 +68,7 @@ internal static StringProperties GetStringProperties(string[] keys, bool enableT
7068 int [ ] ? right = null ;
7169
7270 // Prefix/suffix tracking only makes sense when there are multiple keys, and they are long enough
73- if ( enableTrimming && keys . Length > 1 && minLength > 1 )
71+ if ( enableTrimming && keys . Length > 1 && lengthMap . Min > 1 )
7472 {
7573 // Special case: If all strings have the same length, we can build an entropy map in O(n) with O(1) memory
7674 // TODO: For now FastData only supports prefix/suffix
@@ -126,7 +124,7 @@ internal static StringProperties GetStringProperties(string[] keys, bool enableT
126124 }
127125
128126 // Make sure that we handle the case where all characters in the inputs are the same
129- if ( DeltaData . CountZero ( left ) == minLength || DeltaData . CountZero ( right ) == minLength )
127+ if ( DeltaData . CountZero ( left ) == lengthMap . Min || DeltaData . CountZero ( right ) == lengthMap . Min )
130128 {
131129 left = null ;
132130 right = null ;
@@ -135,7 +133,7 @@ internal static StringProperties GetStringProperties(string[] keys, bool enableT
135133 // }
136134 }
137135
138- return new StringProperties ( new LengthData ( ( uint ) minLength , ( uint ) maxStr . Length , ( uint ) minUtf8ByteLength , ( uint ) maxUtf8ByteLength , ( uint ) minUtf16ByteLength , ( uint ) maxUtf16ByteLength , uniq , lengthMap ) , new DeltaData ( left , right ) , new CharacterData ( allAscii ) ) ;
136+ return new StringProperties ( new LengthData ( ( uint ) lengthMap . Min , ( uint ) maxStr . Length , ( uint ) minUtf8ByteLength , ( uint ) maxUtf8ByteLength , ( uint ) minUtf16ByteLength , ( uint ) maxUtf16ByteLength , uniq , lengthMap ) , new DeltaData ( left , right ) , new CharacterData ( allAscii ) ) ;
139137 }
140138
141139 private static KeyProperties < char > GetCharProperties ( char [ ] keys )
0 commit comments