📄 generateinput.cpp
字号:
/**********************************************/
/* Generator of input bits
/* int * GenerateInputF(struct BasicParaS * ctrl)
/* Written by: Ouyang Ziyue,
/* Date: Jun 11th, 2007,
/* Function: It randomly generates 0s and 1s to build a frame of length of K, the 0s and 1s
/* follow the uniform distribution.
/* Input parameter:
/* The length of information bits(K) is needed.
/* Output parameter:
/* An INT set which includes all the info bits is returned.
/* Note:
/* ctrl should be built before this function is called.
/**********************************************/
#include "parameter_sets.h"
int * GenerateInputF(struct BasicParaS * ctrl)
{
//////////////////////////////////////////////////////////////////////////
//Declaration
int i;
int * temp;
temp = new int[ctrl->codeK];
if(temp == NULL)
exit(0);
//////////////////////////////////////////////////////////////////////////
//Generating
for (i=0; i<ctrl->codeK; i++)
{
* (temp + i) = generate_binary_source();
}
//////////////////////////////////////////////////////////////////////////
//DEBUG
#ifdef DEBUG
printf("The input bits are ... \n");
int j;
for (i=0; i<ctrl->codeK/24; i++)
{
for (j=0; j<24; j++)
{
printf("%2d", * (temp + i*24 +j));
}
printf("\n");
}
if (ctrl->codeK/24)
{
for (i=(ctrl->codeK/24)*24; i<ctrl->codeK; i++)
{
printf("%d ", *(temp+i));
}
}
printf("\n");
#endif
return temp;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -