0001 #define sib(i) (1 + (((i)-1)^0x01)) //((i)&1 ? (i)+1 : (i)-1) //sibling 0002 #define lc(i) (1 + ((i)<<1)) //left child 0003 #define rc(i) ((1+(i)) << 1) //right child 0004 #define ln(i) (lc(sib(i))) //left nephew 0005 #define rn(i) (rc(sib(i))) //right nephew 0006 #define isLC(i) ((0<(i)) && ( 1&(i))) //left child 0007 #define isRC(i) ((0<(i)) && (!(1&(i)))) //right child 0008 #define hasGP(i) (2<(i)) //having grandparent 0009 #define gp(i) (((i)-3) >> 2) //grandparent 0010 #define lp(i) (lc(gp(i))) //left parent = the left child of grandparent 0011 #define rp(i) (rc(gp(i))) //right parent = the right child of grandparent