| 158 | |
| 159 | template<typename B> |
| 160 | int |
| 161 | Encoder_RSC_DB<B>::calc_state_trans(const int in_state, const int in, int& par) |
| 162 | { |
| 163 | // clang-format off |
| 164 | std::vector<int> FF(n_ff, 0); |
| 165 | |
| 166 | for (auto i = 0; i < n_ff; i++) |
| 167 | FF[0] ^= (((in_state >> i) & 1) * poly[4][n_ff - 1 - i]); |
| 168 | FF[0] ^= poly[0][0] * ((in >> 1) & 1); |
| 169 | FF[0] ^= poly[1][0] * ((in) & 1); |
| 170 | |
| 171 | for (auto i = 1; i < n_ff; i++) |
| 172 | { |
| 173 | FF[i] = (in_state >> (n_ff - i)) & 1; |
| 174 | FF[i] ^= poly[0][i] * ((in >> 1) & 1); |
| 175 | FF[i] ^= poly[1][i] * ((in) & 1); |
| 176 | } |
| 177 | |
| 178 | int parY = FF[0] * poly[2][0]; |
| 179 | for (auto i = 1; i < n_ff + 1; i++) |
| 180 | parY ^= ((in_state >> (n_ff - i)) & 1) * poly[2][i]; |
| 181 | |
| 182 | int parW = FF[0] * poly[3][0]; |
| 183 | for (auto i = 1; i < n_ff + 1; i++) |
| 184 | parW ^= ((in_state >> (n_ff - i)) & 1) * poly[3][i]; |
| 185 | |
| 186 | par = (parY << 1) | parW; |
| 187 | |
| 188 | int next_state = 0; |
| 189 | for (auto i = 0; i < n_ff; i++) |
| 190 | next_state = (next_state << 1) | FF[i]; |
| 191 | |
| 192 | return next_state; |
| 193 | // clang-format on |
| 194 | } |
| 195 | |
| 196 | template<typename B> |
| 197 | void |
nothing calls this directly
no outgoing calls
no test coverage detected