Go backward to Gray Codes Go up to Top Go forward to Block-Oriented Algorithm |
C functions.
int G(int i){
return(i ^ (i/2));}
int G_inv(int i){
int answer, mask; answer = i; mask = answer/2; while (mask > 0){
answer = answer ^ mask; mask = mask / 2;}
return(answer);}