Skip to content

Commit

Permalink
show number of bit flips
Browse files Browse the repository at this point in the history
  • Loading branch information
xdsopl committed Feb 22, 2024
1 parent 5673192 commit 4d43a58
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions decode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,16 @@ struct Decoder
std::cerr << "payload decoding error." << std::endl;
return;
}
for (int i = 0; i < data_bits; ++i)
CODE::set_le_bit(out, i, mesg[i].v[best] < 0);
int flips = 0;
for (int i = 0, j = 0; i < data_bits; ++i, ++j) {
while ((frozen_bits[j / 32] >> (j % 32)) & 1)
++j;
bool received = code[j] < 0;
bool decoded = mesg[i].v[best] < 0;
flips += received != decoded;
CODE::set_le_bit(out, i, decoded);
}
std::cerr << "bit flips: " << flips << std::endl;
}
};

Expand Down

0 comments on commit 4d43a58

Please sign in to comment.