mutlib/trace.cpp: wrong interval mode compute
Brought to you by:
awhitwham,
jkbonfield
--- src/mutlib/trace.cpp 2005-04-27 16:17:35 +0000
+++ -
@@ -953,20 +953,21 @@
// Compute the mode by counting the maximum run length
int nRun = 0;
int nRunMax = 0;
int nLast = -1;
m_nIntervalMode = 0;
for( n=0; n<nBases; n++ )
{
if( Interval[n] == nLast )
nRun++;
else
{
if( nRun > nRunMax )
{
m_nIntervalMode = nLast;
nRunMax = nRun;
}
nRun = 1;
nLast = Interval[n];
}
}
+ if( nRun > m_nIntervalMode ) m_nIntervalMode = nRun;
The maximum run length may reside in the tail part of Interval[], so we need one more compare after n reach nBases. And in a simulation scenario when all interval are made same, the wrong interval mode being 0 lead to crash.
Sorry wrong patch, should be: