X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=bp.h;h=f10902671417f31489b11e73a86e9d7b9609364b;hb=f32808a35be7a1e62830a5972473178014fa44e5;hp=30c841e40f45a18e703e7f7222f5f27033a00c5f;hpb=0bf9688e2615a9fc07860c5762240e4ce26ee5d3;p=SXSI%2FXMLTree.git diff --git a/bp.h b/bp.h index 30c841e..f109026 100644 --- a/bp.h +++ b/bp.h @@ -1,3 +1,6 @@ +#ifndef BP_H_ +#define BP_H_ + #include #include #include "darray.h" @@ -30,15 +33,9 @@ //#define logMB 3 #define MB (1<(y)?(x):(y)) -#endif typedef struct { @@ -129,7 +126,18 @@ void saveTree(bp *b, FILE *fp); void loadTree(bp *b, FILE *fp); void destroyTree(bp *b); -int blog(int x); + +inline int blog(int x) +{ + int l; + l = 0; + while (x>0) { + x>>=1; + l++; + } + return l; +} + pb getpat_preorder(pb *b); pb getpat_leaf(pb *b); pb getpat_inorder(pb *b); @@ -156,3 +164,6 @@ extern int degtbl2[(2*ETW+1)*(1<