| 12 | |
| 13 | template<typename B> |
| 14 | Encoder_RS<B>::Encoder_RS(const int& K, const int& N, const tools::RS_polynomial_generator& GF) |
| 15 | : Encoder<B>(K * GF.get_m(), N * GF.get_m()) |
| 16 | , K_rs(K) |
| 17 | , N_rs(N) |
| 18 | , m(GF.get_m()) |
| 19 | , n_rdncy_bits(GF.get_n_rdncy() * m) |
| 20 | , n_rdncy(GF.get_n_rdncy()) |
| 21 | , alpha_to(GF.get_alpha_to()) |
| 22 | , index_of(GF.get_index_of()) |
| 23 | , g(GF.get_g()) |
| 24 | , mt(GF.get_mt()) |
| 25 | , bb(n_rdncy) |
| 26 | , packed_U_K(K_rs) |
| 27 | , packed_X_N(N_rs) |
| 28 | { |
| 29 | const std::string name = "Encoder_RS"; |
| 30 | this->set_name(name); |
| 31 | for (auto& t : this->tasks) |
| 32 | t->set_replicability(true); |
| 33 | |
| 34 | if ((this->N_rs - this->K_rs) != n_rdncy) |
| 35 | { |
| 36 | std::stringstream message; |
| 37 | message << "'N_rs - K_rs' is different than 'n_rdncy' ('K_rs' = " << K_rs << ", 'N_rs' = " << N_rs |
| 38 | << ", 'n_rdncy' = " << n_rdncy << ", 'N_rs - K_rs' = " << (this->N_rs - this->K_rs) << ")."; |
| 39 | throw spu::tools::invalid_argument(__FILE__, __LINE__, __func__, message.str()); |
| 40 | } |
| 41 | |
| 42 | if ((int)sizeof(S) * CHAR_BIT < GF.get_m()) |
| 43 | { |
| 44 | std::stringstream message; |
| 45 | message << "The given Galois Field is too big to be stored in a 'S' type ('S' = " << typeid(S).name() |
| 46 | << ", 'GF.get_m()' = " << GF.get_m() << ")."; |
| 47 | throw spu::tools::invalid_argument(__FILE__, __LINE__, __func__, message.str()); |
| 48 | } |
| 49 | |
| 50 | std::iota( |
| 51 | this->info_bits_pos.begin(), this->info_bits_pos.end(), n_rdncy); // redundancy on the first 'n_rdncy' bits |
| 52 | } |
| 53 | |
| 54 | template<typename B> |
| 55 | Encoder_RS<B>* |
nothing calls this directly
no test coverage detected