📄 lgold.c
字号:
/* * $Log: lgold.c,v $ * Revision 1.1 2000/05/03 14:30:04 bjc97r * Initial revision * */char *_lgold_id = "$Id: lgold.c,v 1.1 2000/05/03 14:30:04 bjc97r Exp $";#include <stdio.h>#include <stdlib.h>#include "lgold.h"#include "lmseq.h"/* * It creates a long Gold code generator with the two preferred m-sequences * with the given seeds. The Gold code generator is returned. */LGold * lgold_create( unsigned deg, char *p0, char *p1, u2long s0, u2long s1 ){ LGold *gold; if ( deg > 63 ) { fprintf(stderr, "lgold_create: ..cannot handle deg > 63\n"); return NULL; } gold = (LGold*) malloc ( sizeof(LGold) ); gold->mseq0 = lmseq_create( deg, p0, s0.h, s0.l ); gold->mseq1 = lmseq_create( deg, p1, s1.h, s1.l ); return gold;}/* lgold_free() deallocates the memory space for the Gold sequence generator.*/void lgold_free( LGold *gold ){ lmseq_free( gold->mseq0 ); lmseq_free( gold->mseq1 ); free( gold );}/* lgold() gives the next Gold sequence. The sequence is unipolar, ie 1 or 0.*/char lgold( LGold *gold ){ return lmseq(gold->mseq0) ^ lmseq(gold->mseq1);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -