From 0334a2a9094cc7ed8209c89ff34dc038b2e3ee11 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Thu, 20 Dec 2018 08:49:28 +0100
Subject: [PATCH] fixing after merge with develop-nr. nr_pbchsim not functional

---
 openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c | 2 +-
 openair1/PHY/CODING/nr_polar_init.c                  | 2 +-
 openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c               | 3 +--
 openair1/SIMULATION/NR_PHY/pbchsim.c                 | 2 +-
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
index 2eb68b9469..799abaee90 100644
--- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
+++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_encoder.c
@@ -442,7 +442,7 @@ void polar_encoder_fast(uint64_t *A,
   // b_{N'-1} b_{N'-2} ... b_{N'-A} b_{N'-A-1} ... b_{N'-A-Nparity} = a_{N-1} a_{N-2} ... a_{N-A} p_{N_parity-1} ... p_0
 
   for (n=0;n<quadwlen;n++) if (n==0) B[n] = (A[n] << polarParams->crcParityBits) | tcrc;
-                           else      B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>64-polarParams->crcParityBits);
+                           else      B[n] = (A[n] << polarParams->crcParityBits) | (A[n-1]>>(64-polarParams->crcParityBits));
   
     
   uint8_t *Bbyte = (uint8_t*)B;
diff --git a/openair1/PHY/CODING/nr_polar_init.c b/openair1/PHY/CODING/nr_polar_init.c
index 19386ee52c..f6a0bfa81e 100644
--- a/openair1/PHY/CODING/nr_polar_init.c
+++ b/openair1/PHY/CODING/nr_polar_init.c
@@ -51,7 +51,7 @@ void nr_polar_init(t_nrPolar_paramsPtr *polarParams,
 
 	//Parse the list. If the node is already created, return without initialization.
 	while (currentPtr != NULL) {
-	  printf("currentPtr->idx %d, (%d,%d,%d)\n",currentPtr->idx,messageType,messageLength,aggregation_prime);
+	  //	  printf("currentPtr->idx %d, (%d,%d,%d)\n",currentPtr->idx,messageType,messageLength,aggregation_prime);
 	  if (currentPtr->idx == (messageType * messageLength * aggregation_prime)) return;
 	  else currentPtr = currentPtr->nextPtr;
 	}
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
index b0893bd976..846b357805 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c
@@ -515,7 +515,7 @@ unsigned char sign(int8_t x) {
 */
 
 uint8_t pbch_deinterleaving_pattern[32] = {28,0,31,30,7,29,25,27,5,8,24,9,10,11,12,13,1,4,3,14,15,16,17,2,26,18,19,20,21,22,6,23};
-
+ 
 int nr_rx_pbch( PHY_VARS_NR_UE *ue,
 		UE_nr_rxtx_proc_t *proc,
 		NR_UE_PBCH *nr_ue_pbch_vars,
@@ -661,7 +661,6 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
 
   //polar decoding de-rate matching
 
-  nr_ue_pbch_vars->nrPolar_params = NULL;
   nr_polar_init(&nr_ue_pbch_vars->nrPolar_params,
 		NR_POLAR_PBCH_MESSAGE_TYPE,
 		NR_POLAR_PBCH_PAYLOAD_BITS,
diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c
index e16d139f6a..754345e19f 100644
--- a/openair1/SIMULATION/NR_PHY/pbchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pbchsim.c
@@ -557,7 +557,7 @@ int main(int argc, char **argv)
 		    0,
 		    1,
 		    NR_PBCH_EST);
-	
+	 
 	ret = nr_rx_pbch(UE,
 			 &UE->proc.proc_rxtx[0],
 			 UE->pbch_vars[0],
-- 
2.26.2