|
|
| 601 |
B1 = B + C * L; |
601 |
B1 = B + C * L; |
| 602 |
} |
602 |
} |
| 603 |
// first segmentation: K+ = minimum K in table such that C * K >= B1 |
603 |
// first segmentation: K+ = minimum K in table such that C * K >= B1 |
| 604 |
// uint i = 0; |
|
|
| 605 |
// while (B1 > cbSizeTable[i] * C) |
| 606 |
// { |
| 607 |
// // NS_LOG_INFO (" K+ " << cbSizeTable[i] << " means " << cbSizeTable[i] * C); |
| 608 |
// i++; |
| 609 |
// } |
| 610 |
// uint16_t KplusId = i; |
| 611 |
// Kplus = cbSizeTable[i]; |
| 612 |
|
| 613 |
// implement a modified binary search |
604 |
// implement a modified binary search |
| 614 |
int min = 0; |
605 |
int min = 0; |
| 615 |
int max = 187; |
606 |
int max = 187; |
|
|
| 649 |
uint16_t KplusId = mid; |
640 |
uint16_t KplusId = mid; |
| 650 |
Kplus = cbSizeTable[mid]; |
641 |
Kplus = cbSizeTable[mid]; |
| 651 |
|
642 |
|
|
|
643 |
#ifdef NS3_BUILD_PROFILE_DEBUG |
| 644 |
{ |
| 645 |
uint i = 0; |
| 646 |
while (B1 > cbSizeTable[i] * C) |
| 647 |
{ |
| 648 |
i++; |
| 649 |
} |
| 650 |
NS_ASSERT_MSG (i == KplusId, "For B1 = " << B1 << ", C = " << C << " K+ index is " << KplusId << " instead of " << i); |
| 651 |
|
| 652 |
} |
| 653 |
#endif |
| 652 |
|
654 |
|
| 653 |
if (C==1) |
655 |
if (C==1) |
| 654 |
{ |
656 |
{ |