提交 fb633d2c 编写于 作者: F feilong

format

上级 a9e0489c
......@@ -60,12 +60,10 @@ size_t findNatureRangeIndex(std::vector<Range>& rangeList, uint64_t point){
size_t idx = SIZE_MAX;
while (first <= last) {
size_t mid = (first + last) / 2; // compute mid point.
std::cout<<"xx:"<<mid;
// 处理右边界
if (mid >= max - 1) {
uint64_t lastEnd = rangeList[n - 1].m_pos + rangeList[n - 1].m_length;
std::cout<<"point:"<<point<<"lastEnd:"<<lastEnd<<"max:"<<max;
if (point>=lastEnd) {
idx = max - 1;
} else {
......@@ -100,20 +98,15 @@ size_t findNatureRangeIndex(std::vector<Range>& rangeList, uint64_t point){
// 二分查找
if (point>=testEnd) {
std::cout<<"->"<<point<<","<<testBeg<<","<<testEnd<<std::endl;
first = mid + 1; // repeat search in top half.
} else if (point<testBeg) {
std::cout<<"<-"<<point<<","<<testBeg<<","<<testEnd<<std::endl;
last = mid - 1; // repeat search in bottom half.
} else {
std::cout<<point<<","<<testBeg<<","<<testEnd<<std::endl;
idx = mid;
break;
}
}
std::cout<<std::endl;
return idx;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册