From 1eef4c3df5689647a04b9b217b80c2e788f84cfb Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Tue, 5 Nov 2019 09:59:55 +0100 Subject: [PATCH] detect special parity word using offset and shift --- ldpc_decoder.hh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ldpc_decoder.hh b/ldpc_decoder.hh index c00f04e..b02d090 100644 --- a/ldpc_decoder.hh +++ b/ldpc_decoder.hh @@ -95,10 +95,9 @@ class LDPCDecoder for (int k = 0; k < deg; ++k) { int offset = lo[k].off; int shift = lo[k].shi; - shift -= csh[offset]; - shift %= D; - TYPE tmp = rotate(var[offset], shift); - if (i == 0 && offset == VAR-1) { + int dshift = (shift - csh[offset]) % D; + TYPE tmp = rotate(var[offset], dshift); + if (offset == VAR-1 && shift == 1) { prev_val = tmp.v[0]; tmp.v[0] = 127; } @@ -141,7 +140,7 @@ class LDPCDecoder int offset = lo[k].off; int shift = lo[k].shi; - if (i == 0 && offset == VAR-1) + if (offset == VAR-1 && shift == 1) tmp.v[0] = prev_val; if (!write_conflict || !((*wd>>k)&1)) {