View | Details | Raw Unified | Return to bug 2589
Collapse All | Expand All

(-)a/src/lte/model/lte-mi-error-model.cc (-37 / +16 lines)
 Lines 30-35    Link Here 
30
*/ 
30
*/ 
31
31
32
32
33
#include <algorithm>
33
#include <list>
34
#include <list>
34
#include <vector>
35
#include <vector>
35
#include <ns3/log.h>
36
#include <ns3/log.h>
 Lines 102-108    Link Here 
102
  static const int TbsIndex[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, -1, -1};
103
  static const int TbsIndex[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 10, 11, 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, -1, -1};
103
#endif
104
#endif
104
  
105
  
105
  static const uint16_t cbSizeTable[188] = {   // as K column of table 5.1.3-3 of TS 36,212
106
  static const std::array<uint16_t, 188> cbSizeTable = {   // as K column of table 5.1.3-3 of TS 36,212
106
    
107
    
107
    40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152,
108
    40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152,
108
    160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264,
109
    160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 264,
 Lines 601-644    Link Here 
601
      B1 = B + C * L;
602
      B1 = B + C * L;
602
    }
603
    }
603
  // first segmentation: K+ = minimum K in table such that C * K >= B1
604
  // first segmentation: K+ = minimum K in table such that C * K >= B1
604
  // implement a modified binary search
605
  /*
605
  int min = 0;
606
   * Note that comparison function does not satisfy even the "weak"
606
  int max = 187;
607
   * requirements for comparison function stated in Section 25.4
607
  int mid = 0;
608
   * of C++11 standard.  However, the only requirement for binary
608
  do
609
   * search function (lower_bound is one of them) is that
610
   * cbSizeTable is partitioned with respect to e * C < B1,
611
   * and this condition is satisfied.
612
   */
613
  auto KPlusIter = std::lower_bound (begin (cbSizeTable), end (cbSizeTable), B1,
614
    [C] (const uint16_t &a, const uint16_t &b)
609
    {
615
    {
610
      mid = (min+max) / 2;
616
      return a * C < b;
611
      if (B1 > cbSizeTable[mid]*C)
612
        {
613
          if (B1 < cbSizeTable[mid+1]*C)
614
            {
615
              break;
616
            }
617
          else
618
            {
619
              min = mid + 1;
620
            }
621
        }
622
      else
623
        {
624
          if (B1 > cbSizeTable[mid-1]*C)
625
            {
626
              break;
627
            }
628
          else
629
            {
630
              max = mid - 1;
631
            }
632
        }
633
  } while ((cbSizeTable[mid]*C != B1) && (min < max));
634
  // adjust binary search to the largest integer value of K containing B1
635
  if (B1 > cbSizeTable[mid]*C)
636
    {
637
      mid ++;
638
    }
617
    }
639
618
  );
640
  uint16_t KplusId = mid;
619
  uint16_t KplusId = std::distance (begin (cbSizeTable), KPlusIter);
641
  Kplus = cbSizeTable[mid];
620
  Kplus = *KPlusIter;
642
621
643
#ifdef NS3_BUILD_PROFILE_DEBUG
622
#ifdef NS3_BUILD_PROFILE_DEBUG
644
  {
623
  {

Return to bug 2589