Files | |
file | eg_gcit.h |
Data Structures | |
struct | EGgcIt_t |
Structure to store the information relevant to the binary gray code iterator. More... | |
Defines | |
#define | EG_GCIT_DBG 0 |
Debug level for the heap. | |
#define | EGgcItClear(__gc) |
free all internally allocated memory for the given EGgcIt_t structure. | |
#define | EGgcItGetChange(__gc) ((const int)((__gc)->changed_pos)) |
return which position in the binary string changed in the last iteration. | |
#define | EGgcItGetSize(__gc) ((const int)((__gc)->sz)) |
Return the number of bits for the given gray code iterator. | |
#define | EGgcItGetTuple(__gc) ((const int*const)((__gc)->tuple)) |
Return a constant pointer to the current tuple. | |
#define | EGgcItInit(__gc, __sz) |
Initialize a binary gray code iterator, and set the iterator to the zero position. | |
#define | EGgcItNext(__gc) |
move to the next binary string, if no next string exists (i.e. we finish the loop), return 0, otherwise return 1. | |
#define | EGgcItReset(__gc) |
Reset an initialized gray code iterator to the zero position. |
|
Debug level for the heap.
|
|
Value: do{\ EGgcIt_t*const __EGgcit = (__gc);\ EGfree(__EGgcit->tuple);\ EGfree(__EGgcit->focus);\ memset(__EGgcit,0,sizeof(EGgcIt_t));}while(0)
|
|
return which position in the binary string changed in the last iteration.
|
|
Return the number of bits for the given gray code iterator.
|
|
Return a constant pointer to the current tuple.
|
|
Value: do{\ EGgcIt_t*const __EGgcit = (__gc);\ const int __EGgcsz = __EGgcit->sz = ((int)(__sz));\ __EGgcit->tuple = EGsMalloc(int,__EGgcsz);\ __EGgcit->focus = EGsMalloc(int,__EGgcsz+1);\ EGgcItReset(__EGgcit);}while(0)
|
|
Value: ({\ EGgcIt_t*const __EGgcit = (__gc);\ const int __EGgccp = __EGgcit->changed_pos = __EGgcit->focus[0];\ const int __EGgcrval=(__EGgccp!=__EGgcit->sz);\ if(__EGgcrval){\ __EGgcit->focus[0]=0;\ __EGgcit->focus[__EGgccp]=__EGgcit->focus[__EGgccp+1];\ __EGgcit->focus[__EGgccp+1]=__EGgccp+1;\ __EGgcit->tuple[__EGgccp] = 1-__EGgcit->tuple[__EGgccp];}\ __EGgcrval;})
|
|
Value: do{\ EGgcIt_t*const __EGgcit2 = (__gc);\ register int __EGgci = __EGgcit2->sz;\ __EGgcit2->focus[__EGgci]=__EGgci;\ while(__EGgci--){__EGgcit2->tuple[__EGgci] = 0;\ __EGgcit2->focus[__EGgci]=__EGgci;}\ __EGgcit2->changed_pos=0;}while(0)
|