diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2004-11-18 20:11:50 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2004-11-18 20:11:50 (GMT) |
commit | 6ec311b1d32001ec035902ca2c8420ecc216e14d (patch) | |
tree | 6b34e12044d5a51642ed1e1a7824790ef772c5c2 /src/H5TBprivate.h | |
parent | 8c97a51f70c7fb3ddbc50aa32f76750a4da54037 (diff) | |
download | hdf5-6ec311b1d32001ec035902ca2c8420ecc216e14d.zip hdf5-6ec311b1d32001ec035902ca2c8420ecc216e14d.tar.gz hdf5-6ec311b1d32001ec035902ca2c8420ecc216e14d.tar.bz2 |
[svn-r9550] Purpose:
Code optimization
Description:
Rework & move around some of the macros for querying balanced properties
of nodes to speed up tree balancing code.
Platforms tested:
FreeBSD 4.10 (sleipnir) w/parallel
Solaris 2.7 (arabica)
Too minor to require h5committest
Diffstat (limited to 'src/H5TBprivate.h')
-rw-r--r-- | src/H5TBprivate.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/H5TBprivate.h b/src/H5TBprivate.h index a58fc39..355fcef 100644 --- a/src/H5TBprivate.h +++ b/src/H5TBprivate.h @@ -59,14 +59,19 @@ typedef int (*H5TB_cmp_t)(const void *k1, const void *k2, int cmparg); # define HasChild(n,s) ( Cnt(n,s)>0 ) # define Heavy(n,s) ( (s) & (LeftCnt(n)>RightCnt(n) ? LEFT : \ LeftCnt(n)==RightCnt(n) ? 0 : RIGHT)) +# define HeavyCnt(l,r,s) ( (s) & ((l)>(r) ? LEFT : (l)==(r) ? 0 : RIGHT)) # define Intern(n) ( LeftCnt(n) && RightCnt(n) ) # define UnBal(n) ( LeftCnt(n)>RightCnt(n) ? LEFT : \ LeftCnt(n)==RightCnt(n) ? 0 : RIGHT) -# define UnBalanced(n) ( LeftCnt(n)!=RightCnt(n) ? 1 : 0) +# define UnBalanced(n) ( LeftCnt(n)!=RightCnt(n) ) +# define UnBalancedCnt(l,r) ( (l)!=(r) ) # define Double(n) ( H5TB_DOUBLE & (n)->flags ) # define Other(side) ( LEFT + RIGHT - (side) ) # define Weight(n) ( Double(n) ? 2 : UnBalanced(n) ) +# define WeightCnt(l,r,d) ( (d) ? 2 : UnBalancedCnt(l,r) ) # define Delta(n,s) ( Heavy(n,s) ? Weight(n) : -Weight(n) ) +# define DeltaCnt(l,r,d,s) ( HeavyCnt(l,r,s) ? WeightCnt(l,r,d) : \ + -WeightCnt(l,r,d) ) # define SetFlags(n,s,b,i) ( ( -2<(b) && (b)<2 ? 0 : H5TB_DOUBLE ) \ | ( 0>(b) ? H5TB_HEAVY(s) : (b)>0 ? H5TB_HEAVY(Other(s)) : 0 ) \ | ( (i) ? H5TB_INTERN : 0 ) ) |