?? ogold.c
字號:
/* * $Log: ogold.c,v $ * Revision 1.1 2000/05/03 14:30:04 bjc97r * Initial revision * */char *_ogold_id = "$Id: ogold.c,v 1.1 2000/05/03 14:30:04 bjc97r Exp $";#include <stdio.h>#include <stdlib.h>#include "ogold.h"/* * It create an OGold code generator with the two preferred m-sequences * with the given index. The OGold code generator is returned. * The possible range of index is 0 to (2^deg - 1). */OGold *ogold_create( unsigned deg, unsigned long p0, unsigned long p1, unsigned long index ){ OGold *ogold; if ( deg > 31 ) { fprintf(stderr, "ogold_create: ..cannot handle deg > 31\n"); return NULL; } ogold = (OGold*) malloc( sizeof(OGold) ); ogold->gold = gold_create( deg, p0, p1, index, 1 ); ogold->period = 1 << deg; /* 2^deg */ ogold->counter = 1; return ogold;}/* ogold_free() deallocates the memory space for the OGold code generator. */void ogold_free( OGold *ogold ){ gold_free( ogold->gold ); free( ogold );}/* ogold() gives the next OGold sequence in unipolar value, ie 1 or 0. */char ogold( OGold *id ){ if ( id->counter == id->period ) { id->counter = 1; return 0; } id->counter++; return gold(id->gold);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -