9 #ifndef __ZEDA_RRTAB_H__ 10 #define __ZEDA_RRTAB_H__ 27 #define zRRTabClass(tab_t,cell_t) \ 32 tab_t *tab_t##Alloc(tab_t *tab, uint n);\ 33 void tab_t##Free(tab_t *tab);\ 34 cell_t *tab_t##Cell(tab_t *tab, uint i, uint j);\ 36 #define zRRTabClassMethod(tab_t,cell_t) \ 37 tab_t *tab_t##Alloc(tab_t *tab, uint n)\ 39 if( !( tab->buf = zAlloc( cell_t, n*(n-1)/2 ) ) ){\ 46 void tab_t##Free(tab_t *tab)\ 51 cell_t *tab_t##Cell(tab_t *tab, uint i, uint j)\ 53 if( i == j || i >= tab->num || j >= tab->num ) return NULL;\ 54 if( i > j ) zSwap( int, i, j );\ 55 return tab->buf + ( 2*tab->num - i - 1 ) * i / 2 + j - i - 1;\ 76 #define zRRBoolCheck(tab,i,j) ( zRRBoolCell(tab,i,j) ? *zRRBoolCell(tab,i,j) : false ) 77 #define zRRBoolMark(tab,i,j) do{ if( zRRBoolCell(tab,i,j) ){ *zRRBoolCell(tab,i,j) = true; } } while( 0 ) 78 #define zRRBoolUnmark(tab,i,j) do{ if( zRRBoolCell(tab,i,j) ){ *zRRBoolCell(tab,i,j) = false; } } while( 0 ) #define __END_DECLS
Definition: zeda_defs.h:30
#define __BEGIN_DECLS
Definition: zeda_defs.h:26
boolean table - an example of round-robin table.
Definition: zeda_rrtab.h:74
#define zRRTabClass(tab_t, cell_t)
generate round-robin table class.
Definition: zeda_rrtab.h:27