Minor code review

This commit is contained in:
Raymond Hill 2023-10-10 13:30:18 -04:00
parent 3a5606125d
commit f15dff27fe
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 34 additions and 30 deletions

View File

@ -2643,7 +2643,8 @@ class FilterBucket extends FilterCollection {
} }
static optimize(idata, optimizeBits = 0b11) { static optimize(idata, optimizeBits = 0b11) {
if ( filterData[idata+2] >= 3 && (optimizeBits & 0b01) !== 0 ) { if ( (optimizeBits & 0b01) !== 0 ) {
if ( filterData[idata+2] >= 3 ) {
const iplaintrie = this.optimizePatternTests(idata); const iplaintrie = this.optimizePatternTests(idata);
if ( iplaintrie !== 0 ) { if ( iplaintrie !== 0 ) {
const icollection = filterData[idata+1]; const icollection = filterData[idata+1];
@ -2652,7 +2653,9 @@ class FilterBucket extends FilterCollection {
this.unshift(idata, iplaintrie); this.unshift(idata, iplaintrie);
} }
} }
if ( filterData[idata+2] >= 5 && (optimizeBits & 0b10) !== 0 ) { }
if ( (optimizeBits & 0b10) !== 0 ) {
if ( filterData[idata+2] >= 5 ) {
const ioptimized = this.optimizeMatch( const ioptimized = this.optimizeMatch(
idata, idata,
FilterBucketIfOriginHits, FilterBucketIfOriginHits,
@ -2665,7 +2668,7 @@ class FilterBucket extends FilterCollection {
this.unshift(idata, ioptimized); this.unshift(idata, ioptimized);
} }
} }
if ( filterData[idata+2] >= 5 && (optimizeBits & 0b10) !== 0 ) { if ( filterData[idata+2] >= 5 ) {
const ioptimized = this.optimizeMatch( const ioptimized = this.optimizeMatch(
idata, idata,
FilterBucketIfRegexHits, FilterBucketIfRegexHits,
@ -2678,6 +2681,7 @@ class FilterBucket extends FilterCollection {
this.unshift(idata, ioptimized); this.unshift(idata, ioptimized);
} }
} }
}
return 0; return 0;
} }