📄 conversions.c
字号:
/* | | Copyright disclaimer: | This software was developed at the National Institute of Standards | and Technology by employees of the Federal Government in the course | of their official duties. Pursuant to title 17 Section 105 of the | United States Code this software is not subject to copyright | protection and is in the public domain. | | We would appreciate acknowledgement if the software is used. |*//* | Project: WCDMA simulation environment | Module: Data type conversions | Author: Tommi Makelainen, Nokia/NIST | Date: January 5, 1999 | | History: | January 5, 1999 Tommi Makelainen | Initial version. | */#include <stdio.h>#include <math.h>/* * Function: bin2antipodal * Desc.: Convert input data vector in binary (0,1) to * antipodal (-1,1) output vector. * * Inputs: * binary input data bit vector in binary (0,1) form * data_len length of input data vector * Outputs: * antipodal output data vector in antipodal (-1,1) form * * Note: */int bin2antipodal(int binary[], int data_len, int antipodal[]){ int i; for (i=0; i < data_len; i++) { antipodal[i] = binary[i]*2 - 1; } return(0);}/* * Function: antipodal2bin * Desc.: Convert input data vector in antipodal (-1,1) to * binary (0,1) output vector. * * Inputs: * antipodal input data bit vector in antipodal (-1,1) form * data_len length of input data vector * Outputs: * binary output data vector in binary (0,1) form * * Note: */int antipodal2bin(int antipodal[], int data_len, int binary[]){ int i; for (i=0; i < data_len; i++) { binary[i] = (antipodal[i] + 1) >> 1; } return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -