Fix a few compile errors/OOB array accesses

This commit is contained in:
Matt Corallo 2017-06-02 11:12:03 -04:00
parent e6753965a1
commit a08601da26
4 changed files with 6 additions and 6 deletions

View File

@ -936,7 +936,7 @@ static void FFTInitialize()
}
}
for (unsigned i = 0; i < kOrder; ++i)
for (unsigned i = 0; i < kModulus; ++i)
FFTSkew[i] = LogLUT[FFTSkew[i]];
// Precalculate FWHT(Log[i]):
@ -1057,6 +1057,7 @@ void ReedSolomonEncode(
}
}
const unsigned last_count = original_count % m;
if (m >= original_count)
goto skip_body;
@ -1100,7 +1101,6 @@ void ReedSolomonEncode(
temp);
}
const unsigned last_count = original_count % m;
if (last_count != 0)
{
const unsigned i = original_count - last_count;

View File

@ -67,7 +67,7 @@ static const unsigned kPolynomial = 0x1002D;
// Fast Walsh-Hadamard Transform (FWHT) (mod kModulus)
// Transform for a variable number of bits (up to kOrder)
void FWHT(ffe_t* data, const unsigned bits);
//void FWHT(ffe_t* data, const unsigned bits);
// Transform specialized for the finite field order
void FWHT(ffe_t data[kOrder]);

View File

@ -416,7 +416,7 @@ static void FFTInitialize()
}
}
for (unsigned i = 0; i < kOrder; ++i)
for (unsigned i = 0; i < kModulus; ++i)
FFTSkew[i] = LogLUT[FFTSkew[i]];
// Precalculate FWHT(Log[i]):
@ -1421,6 +1421,7 @@ void ReedSolomonEncode(
m,
skewLUT);
const unsigned last_count = original_count % m;
if (m >= original_count)
goto skip_body;
@ -1443,7 +1444,6 @@ void ReedSolomonEncode(
}
// Handle final partial set of m pieces:
const unsigned last_count = original_count % m;
if (last_count != 0)
{
const unsigned i = original_count - last_count;

View File

@ -68,7 +68,7 @@ static const unsigned kPolynomial = 0x11D;
// Transform for a variable number of elements
// m_truncated: Number of elements that are non-zero at the front of data
void FWHT(ffe_t* data, const unsigned m, const unsigned m_truncated);
//void FWHT(ffe_t* data, const unsigned m, const unsigned m_truncated);
//------------------------------------------------------------------------------