Commit 76b1ee89 authored by yilmazt's avatar yilmazt
Browse files

Working polartest.c

parent ca207808
......@@ -11,7 +11,7 @@
#include "PHY/defs_gNB.h"
#include "SIMULATION/TOOLS/sim.h"
#define DEBUG_POLAR_PARAMS
//#define DEBUG_POLAR_PARAMS
int main(int argc, char *argv[]) {
......@@ -138,9 +138,12 @@ int main(int argc, char *argv[]) {
in[0]=0x01189400;
in[1]=0xffffff0f;
uint8_t *out = malloc(sizeof(uint8_t) * 41);
nr_bit2byte(in, 41, out);
nr_bit2byte_uint32_8_t(in, 41, out);
for (int i=0;i<41;i++)
printf("out[%d]=%d\n",i,out[i]);
uint32_t inn[4];
nr_byte2bit_uint8_32_t(out, 41, inn);
printf("inn[0]=%#x, inn[1]=%#x\n",inn[0],inn[1]);
return (0);
#endif
......
......@@ -33,9 +33,11 @@ void nr_bit2byte_uint32_8_t(uint32_t *in, uint16_t arraySize, uint8_t *out) {
void nr_byte2bit_uint8_32_t(uint8_t *in, uint16_t arraySize, uint32_t *out) {
uint8_t arrayInd = ceil(arraySize / 32.0);
for (int i = 0; i < arrayInd; i++) {
for (int j = 0; j < 32; j++) {
out[i]|=in[j+(i*32)];
out[i]=0;
for (int j = 31; j > 0; j--) {
out[i]|=in[(i*32)+j];
out[i]<<=1;
}
out[i]|=in[(i*32)];
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment