⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 walsh.c

📁 在linux系统下开发研究移动通信的工具型代码
💻 C
字号:
/* * $Log: walsh.c,v $ * Revision 1.1  2000/05/03 14:30:04  bjc97r * Initial revision * */char *_walsh_id = "$Id: walsh.c,v 1.1 2000/05/03 14:30:04 bjc97r Exp $";#include <stdio.h>#include <stdlib.h>#include "walsh.h"/* * It create a Walsh code generator of the given index with the * given seed. The Walsh code generator is returned. */Walsh *walsh_create( unsigned long index, unsigned long seed ){  Walsh *walsh;  walsh = (Walsh*) malloc( sizeof(Walsh) );  walsh->state = seed;  walsh->index = index;  return walsh;}void walsh_free( Walsh *walsh ){  free(walsh);}/* * walsh() gives the next Walsh sequence of the Walsh code generator. * The used algorithm is the direct implementation of one given * at pp542 of "Introduction to Spread Spectrum Communicatrions" by * Peterson et al. */char walsh( Walsh *id ){  unsigned long dump; /* dumped current state */  char seq; /* the Wlash sequence */    dump = id->index & id->state;  id->state++;  seq = 0;  while( dump ) {    seq ^= dump & 1;    dump >>= 1;  }  return seq;}

⌨️ 快捷键说明

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