diff --git a/pac_encoder.hh b/pac_encoder.hh index a9b0594..605c082 100644 --- a/pac_encoder.hh +++ b/pac_encoder.hh @@ -20,10 +20,12 @@ class PACEncoder } static bool conv(int *state, bool input) { - bool s1 = *state & 1; - bool s2 = *state & 2; - bool output = input ^ s1 ^ s2; - *state = (s1 << 1) | output; + 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); return output; } public: diff --git a/pac_list_decoder.hh b/pac_list_decoder.hh index 3630120..0b0e130 100644 --- a/pac_list_decoder.hh +++ b/pac_list_decoder.hh @@ -41,10 +41,12 @@ struct PACListNode typedef typename PH::MAP MAP; static bool conv(int *state, bool input) { - bool s1 = *state & 1; - bool s2 = *state & 2; - bool output = input ^ s1 ^ s2; - *state = (s1 << 1) | output; + 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); return output; } static MAP rate0(PATH *metric, TYPE *hard, TYPE *soft)