summaryrefslogtreecommitdiffstats
path: root/src/H5TBprivate.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2004-11-18 20:11:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2004-11-18 20:11:54 (GMT)
commit8bf670baf64e0e6038e43c7f4473b84a758dcc2c (patch)
tree709a845fb3b76e71ce289bfac700f43d944d5931 /src/H5TBprivate.h
parent9a3071eadc1234866ee9c379c11b85a85cb394e8 (diff)
downloadhdf5-8bf670baf64e0e6038e43c7f4473b84a758dcc2c.zip
hdf5-8bf670baf64e0e6038e43c7f4473b84a758dcc2c.tar.gz
hdf5-8bf670baf64e0e6038e43c7f4473b84a758dcc2c.tar.bz2
[svn-r9551] 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.h7
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 ) )