pnutil.c

来自「产生PN序列」· C语言 代码 · 共 36 行

C
36
字号
/* * $Log: pnutil.c,v $ * Revision 1.1  2000/05/03 14:30:04  bjc97r * Initial revision * */char *_pnutil_id = "$Id: pnutil.c,v 1.1 2000/05/03 14:30:04 bjc97r Exp $";int pn_xcorr( char *pn1, char *pn2, int offset, int size )  /* It finds the cross-correlation of the two given sequence in pn[].     size is the array size of pn?[].     The calculated cross-correlation before scaling is returned. */{  int val;  /* calculated auto-correlation value */  int i, j; /* loop indices */    val = 0;  for( i = 0, j = offset; i < size; i++, j++ ) {    if ( j >= size ) j -= size;    if ( pn1[i] == pn2[j] )      val++;    else      val--;  }    return val;}int pn_acorr( char *pn, int offset, int size )  /* It finds the auto-correlation of the given sequence in pn[].     size is the array size of pn[].     The calculated auto-correlation before scaling is returned. */{  return pn_xcorr( pn, pn, offset, size );}

⌨️ 快捷键说明

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