utility.c

来自「wcdma模型」· C语言 代码 · 共 63 行

C
63
字号
/* | | 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. |*/#include <stdlib.h>#include <math.h>#include <stdio.h>#include <ctype.h> #include <string.h>#include "utility.h"/* -------------------------------------------------------------- */int IntPower( int k, int m){  int ival, i;  ival=1;  for(i=1; i<=m;i++) ival *=k;  return(ival);};                /* -------------------------------------------------------------- */unsigned short int LongParity(unsigned long int long_word){  unsigned short int parity,i;  parity = 0;  for(i=1;i<=32;i++) {	parity=parity^(unsigned short int)(long_word%2);	long_word/=2;  }  return(parity);}                         /* -------------------------------------------------------------- */unsigned short int Parity(unsigned short int short_word){  unsigned short int parity,i;  parity = 0;  for(i=1;i<=16;i++) {	parity=parity^(unsigned short int)(short_word%2);	short_word/=2;  }  return(parity);}                         /* -------------------------------------------------------------- */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?