From 174f569cd91765f8799645472b42490f4f9e46ec Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Tue, 23 Dec 2025 18:03:13 +0100 Subject: [PATCH] let's try the reversed poly 1101101 --- pac_encoder.hh | 13 ++++++++----- pac_list_decoder.hh | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/pac_encoder.hh b/pac_encoder.hh index c3ab9c0..9622a01 100644 --- a/pac_encoder.hh +++ b/pac_encoder.hh @@ -21,18 +21,21 @@ class PACEncoder static bool conv(int *state, bool input) { #if 0 + // 1011011 bool b1 = (*state >> 1) & 1; bool b3 = (*state >> 3) & 1; bool b4 = (*state >> 4) & 1; bool b6 = (*state >> 6) & 1; bool output = input ^ b1 ^ b3 ^ b4 ^ b6; - *state = ((*state & 126) << 1) | (input ? 2 : 0) | (output ? 1 : 0); #else - bool s1 = *state & 1; - bool s2 = *state & 2; - bool output = input ^ s1 ^ s2; - *state = (s1 << 1) | output; + // 1101101 + bool b2 = (*state >> 2) & 1; + bool b3 = (*state >> 3) & 1; + bool b5 = (*state >> 5) & 1; + bool b6 = (*state >> 6) & 1; + bool output = input ^ b2 ^ b3 ^ b5 ^ b6; #endif + *state = ((*state & 126) << 1) | (input ? 2 : 0) | (output ? 1 : 0); return output; } public: diff --git a/pac_list_decoder.hh b/pac_list_decoder.hh index 2e55df5..321bae8 100644 --- a/pac_list_decoder.hh +++ b/pac_list_decoder.hh @@ -20,18 +20,21 @@ struct PACListLeaf static bool conv(int *state, bool input) { #if 0 + // 1011011 bool b1 = (*state >> 1) & 1; bool b3 = (*state >> 3) & 1; bool b4 = (*state >> 4) & 1; bool b6 = (*state >> 6) & 1; bool output = input ^ b1 ^ b3 ^ b4 ^ b6; - *state = ((*state & 126) << 1) | (input ? 2 : 0) | (output ? 1 : 0); #else - bool s1 = *state & 1; - bool s2 = *state & 2; - bool output = input ^ s1 ^ s2; - *state = (s1 << 1) | output; + // 1101101 + bool b2 = (*state >> 2) & 1; + bool b3 = (*state >> 3) & 1; + bool b5 = (*state >> 5) & 1; + bool b6 = (*state >> 6) & 1; + bool output = input ^ b2 ^ b3 ^ b5 ^ b6; #endif + *state = ((*state & 126) << 1) | (input ? 2 : 0) | (output ? 1 : 0); return output; } static MAP rate0(PATH *metric, int *state, TYPE *hard, TYPE *soft)