Bug 2898 - Coding issue in function RrcAsn1Header::DeserializeRachConfigCommon
Coding issue in function RrcAsn1Header::DeserializeRachConfigCommon
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: lte
ns-3-dev
All All
: P3 normal
Assigned To: Manuel Requena
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-07 20:23 UTC by Robert Ammon
Modified: 2018-03-08 06:57 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Ammon 2018-03-07 20:23:22 UTC
The following code is an extract of some of the code in function RrcAsn1Header::DeserializeRachConfigCommon.  The the code, the value of  rachConfigCommon->preambleInfo.numberOfRaPreambles is set in the switch statement, then after the switch statement, the value is also set by an assignment statement.

As written one of these (the switch statement or the assign statement) is not required and should be removed.  Note, the two statements do not produce the same result so its significant which of the duplicated assignments are removed.

  // numberOfRA-Preambles
  bIterator = DeserializeEnum (16,&n,bIterator);
  switch (n)
    {
    case 0:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 4;
      break;
    case 1:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 8;
      break;
    case 2:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 12;
      break;
    case 3:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 16;
      break;
    case 4:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 20;
      break;
    case 5:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 24;
      break;
    case 6:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 28;
      break;
    case 7:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 32;
      break;
    case 8:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 36;
      break;
    case 9:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 40;
      break;
    case 10:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 44;
      break;
    case 11:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 48;
      break;
    case 12:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 52;
      break;
    case 13:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 56;
      break;
    case 14:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 60;
      break;
    case 15:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 64;
      break;
    default:
      rachConfigCommon->preambleInfo.numberOfRaPreambles = 0;
    }

  rachConfigCommon->preambleInfo.numberOfRaPreambles = static_cast<uint8_t> (n);
Comment 1 Manuel Requena 2018-03-08 06:57:04 UTC
Fixed in changeset:   13400:e4e46fea8876