AssertFatal(polarParams->K<129,"K = %d > 128, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->K<129,"K = %d > 128, is not supported yet\n",polarParams->K);
AssertFatal(polarParams->payloadBits<65,"payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits);
AssertFatal(polarParams->payloadBits<65,"payload bits = %d > 64, is not supported yet\n",polarParams->payloadBits);
uint64_tB[4]={0,0,0,0},Cprime[4]={0,0,0,0};
uint64_tB[4]={0,0,0,0},Cprime[4]={0,0,0,0};
intbitlen=polarParams->payloadBits;
intbitlen=polarParams->payloadBits;
#ifdef DEBUG_POLAR_MATLAB
if(polarParams->K<65)printf("[polar_encoder_fast]A[0] = 0x%llx\n",(unsignedlonglong)(Aprime[0]));//(unsigned long long)(Aprime[0]&(((uint64_t)1<<bitlen)-1)),
#endif
// append crc
// append crc
AssertFatal(bitlen<129,"support for payloads <= 128 bits\n");
AssertFatal(bitlen<129,"support for payloads <= 128 bits\n");
// A bitstring should be stored as a_{N-1} a_{N-2} ... a_{N-A} 0 .... 0, where N=64,128,192,..., N is smallest multiple of 64 greater than or equal to A
// A bit string should be stored as 0, 0, ..., 0, a'_0, a'_1, ..., a'_A-1,
//???a'_{N-1} a'_{N-2} ... a'_{N-A} 0 .... 0, where N=64,128,192,..., N is smallest multiple of 64 greater than or equal to A
// First flip A bitstring byte endian for CRC routines (optimized for DLSCH/ULSCH, not PBCH/PDCCH)
// First flip A bitstring byte endian for CRC routines (optimized for DLSCH/ULSCH, not PBCH/PDCCH)
// CRC reads in each byte in bit positions 7 downto 0, for PBCH/PDCCH we need to read in a_{A-1} downto a_{0}, A = length of bit string (e.g. 32 for PBCH)
// CRC reads in each byte in bit positions 7 down to 0, for PBCH/PDCCH we need to read in a_{A-1} down to a_{0}, A = length of bit string (e.g. 32 for PBCH)