From 76b1ee89fa5225d6a2a61e97f04276fe2c5f188f Mon Sep 17 00:00:00 2001 From: yilmazt Date: Fri, 17 Aug 2018 11:22:13 +0200 Subject: [PATCH] Working polartest.c --- openair1/PHY/CODING/TESTBENCH/polartest.c | 7 +++++-- openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/openair1/PHY/CODING/TESTBENCH/polartest.c b/openair1/PHY/CODING/TESTBENCH/polartest.c index eeca32df78..0a5a4f7aba 100644 --- a/openair1/PHY/CODING/TESTBENCH/polartest.c +++ b/openair1/PHY/CODING/TESTBENCH/polartest.c @@ -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 diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c b/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c index 032eca98d3..4394a2ffff 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c +++ b/openair1/PHY/CODING/nrPolar_tools/nr_bitwise_operations.c @@ -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)]; } }