MCPcopy Create free account
hub / github.com/aff3ct/aff3ct / fb_assert

Method fb_assert

src/Tools/Code/Polar/fb_assert.cpp:6–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include "Tools/Code/Polar/fb_assert.h"
5
6void
7aff3ct::tools::fb_assert(const std::vector<bool>& frozen_bits, const int K, const int N)
8{
9 if (frozen_bits.size() != (size_t)N)
10 {
11 std::stringstream message;
12 message << "The frozen_bits size is invalid ('N' = " << N << ", 'Size' = " << frozen_bits.size() << ").";
13 throw spu::tools::runtime_error(__FILE__, __LINE__, __func__, message.str());
14 }
15
16 auto k = 0;
17 for (auto i = 0; i < N; i++)
18 if (frozen_bits[i] == 0) k++;
19
20 if (K != k)
21 {
22 std::stringstream message;
23 message << "The number of information bits in the frozen_bits is invalid ('K' = " << K << ", 'k' = " << k
24 << ").";
25 throw spu::tools::runtime_error(__FILE__, __LINE__, __func__, message.str());
26 }
27}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected