📄 library.c
字号:
/*************************************************************************** * function_name.c - Software Radio template module * ------------------- * begin : date * authors : name * emails : email address ***************************************************************************//*************************************************************************** * Changes * ------- * date - name - description * **************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include "library.h"/** * Please see header file for description */int countOnes(REG_STATUS in,int numBits) { REG_STATUS chkMask=0x01; int ctr=0; int i; //only bits 0..numBits are relevant (rest unused) for (i=0;i<numBits;i++) { //Check if a one was found if ((in & chkMask) !=0) ctr++; //Shift mask to check next bit chkMask<<=1; } return ctr;}/** * Please see header file for description */int hammingDistance(REG_STATUS input1,REG_STATUS input2,int numBits) { //hamming distance is the number of 1-Bits of the XOR of the two values return countOnes(input1^input2,numBits);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -