tab_t *tab_t##Alloc(tab_t *tab,
uint n)\
{\
if( !( tab->buf =
zAlloc( cell_t, n*(n-1)/2 ) ) ){\
ZALLOCERROR();\
return NULL;\
}\
tab->num = n;\
return tab;\
}\
void tab_t##Free(tab_t *tab)\
{\
zFree( tab->buf );\
tab->num = 0;\
}\
cell_t *tab_t##Cell(tab_t *tab,
uint i,
uint j)\
{\
if( i == j || i >= tab->num || j >= tab->num ) return NULL;\
if( i > j )
zSwap(
int, i, j );\
return tab->buf + ( 2*tab->num - i - 1 ) * i / 2 + j - i - 1;\
}
#define zAlloc(t, n)
Definition: zeda_misc.h:81
#define zSwap(type, a, b)
swap values of two data a and b. type the data type of a and b.
Definition: zeda_misc.h:56
unsigned int uint
Definition: zeda_defs.h:104