mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
fine tune logic
This commit is contained in:
parent
4b7e5e0cb2
commit
e74a06dc05
1 changed files with 9 additions and 6 deletions
|
@ -217,15 +217,18 @@ func calcFlagsI(re *Regexp) (must, cant printFlags) {
|
|||
for i := 0; i < len(re.Rune); i += 2 {
|
||||
lo := max(minFold, re.Rune[i])
|
||||
hi := min(maxFold, re.Rune[i+1])
|
||||
if lo > hi {
|
||||
continue
|
||||
}
|
||||
|
||||
inside += int(hi - lo)
|
||||
outside += int(hi - pre)
|
||||
inside += int(hi - lo + 1)
|
||||
outside += int(lo - pre)
|
||||
pre = max(minFold, hi)
|
||||
}
|
||||
|
||||
outside += int(maxFold - pre)
|
||||
|
||||
if inside > outside {
|
||||
if inside < outside {
|
||||
for i := 0; i < len(re.Rune); i += 2 {
|
||||
lo := max(minFold, re.Rune[i])
|
||||
hi := min(maxFold, re.Rune[i+1])
|
||||
|
@ -242,9 +245,9 @@ func calcFlagsI(re *Regexp) (must, cant printFlags) {
|
|||
}
|
||||
|
||||
// Check characters outside the defined range
|
||||
pre = 0
|
||||
pre = minFold
|
||||
for i := 0; i < len(re.Rune); i += 2 {
|
||||
lo := max(minFold, re.Rune[i])
|
||||
lo := re.Rune[i]
|
||||
hi := min(maxFold, re.Rune[i+1])
|
||||
// Check characters between `pre` and `lo` (outside the defined range)
|
||||
for r := pre; r < lo; r++ {
|
||||
|
@ -254,7 +257,7 @@ func calcFlagsI(re *Regexp) (must, cant printFlags) {
|
|||
}
|
||||
}
|
||||
}
|
||||
pre = max(minFold, hi)
|
||||
pre = max(minFold, hi+1)
|
||||
}
|
||||
|
||||
// Check characters between `pre` and `maxFold`
|
||||
|
|
Loading…
Reference in a new issue