|
Boost-Commit : |
From: chintanraoh_at_[hidden]
Date: 2008-06-17 13:36:50
Author: chintanraoh
Date: 2008-06-17 13:36:50 EDT (Tue, 17 Jun 2008)
New Revision: 46454
URL: http://svn.boost.org/trac/boost/changeset/46454
Log:
fix for proper ordering of keys
Text files modified:
sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia.hpp | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
Modified: sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia.hpp
==============================================================================
--- sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia.hpp (original)
+++ sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia.hpp 2008-06-17 13:36:50 EDT (Tue, 17 Jun 2008)
@@ -354,7 +354,7 @@
inline std::size_t get_nth_bit(const key_element_type &element,const int &n) const
{
- return n==0? 1 : ( element & (1<<(n-1)) );
+ return n==0? 1 : ( ( element&(1<<(bit_width - n )) ) !=0 );
}
//returns inclusive of end bit after each pos and the not(un) common bit in k1;
@@ -389,13 +389,14 @@
{
t1=Key_traits::get_element(k1_it);
t2=Key_traits::get_element(k2_it);
- while((t1 & 0x1)==( t2 & 0x1))
+ //TODO:optimize this part!!!
+ key_element_type x= (key_element_type(1)<<(bit_width-1));
+ while((t1 & x)==( t2 & x))//possibly make this ( t1 & x) != ( t1 & x )
{
- t1>>=1;
- t2>>=1;
+ x>>=1;
++pos;
}
- uncommon_bit=t1%2;
+ uncommon_bit= ((t1 & x)!=0);
++pos;
}
else
@@ -704,5 +705,3 @@
}//namespace boost
#endif //BOOST_DSEARCH_PATRICIA_HPP
-
-
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk