mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
skip metric computation if same as last word
This commit is contained in:
parent
9b1c6cf573
commit
f83c785867
1 changed files with 9 additions and 3 deletions
|
|
@ -75,12 +75,14 @@ public:
|
|||
for (int j = 0; j < N; ++j) {
|
||||
int tmp = 1 << j;
|
||||
int dec = (*this)(cw ^ tmp);
|
||||
if (dec == word)
|
||||
continue;
|
||||
int met = metric(code, dec);
|
||||
if (met > best) {
|
||||
next = best;
|
||||
best = met;
|
||||
word = dec;
|
||||
} else if (word != dec && met > next) {
|
||||
} else if (met > next) {
|
||||
next = met;
|
||||
}
|
||||
}
|
||||
|
|
@ -111,12 +113,14 @@ public:
|
|||
for (int i = 0; i < num; ++i)
|
||||
tmp |= ((j>>i)&1) << worst[i];
|
||||
int dec = (*this)(cw ^ tmp);
|
||||
if (dec == word)
|
||||
continue;
|
||||
int met = metric(code, dec);
|
||||
if (met > best) {
|
||||
next = best;
|
||||
best = met;
|
||||
word = dec;
|
||||
} else if (word != dec && met > next) {
|
||||
} else if (met > next) {
|
||||
next = met;
|
||||
}
|
||||
}
|
||||
|
|
@ -125,12 +129,14 @@ public:
|
|||
if (0) {
|
||||
for (int msg = 0; msg < W; ++msg) {
|
||||
int enc = (msg << P) | par[msg];
|
||||
if (enc == word)
|
||||
continue;
|
||||
int met = metric(code, enc);
|
||||
if (met > best) {
|
||||
next = best;
|
||||
best = met;
|
||||
word = enc;
|
||||
} else if (word != enc && met > next) {
|
||||
} else if (met > next) {
|
||||
next = met;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue