Skip unneeded wrap check in SIMD book keeping (GH #732)

pull/737/head
Jeffrey Walton 2018-11-04 15:35:34 -05:00
parent 29be6ed97a
commit 6cc763939e
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 9 additions and 6 deletions

View File

@ -171,9 +171,10 @@ void ChaCha_Policy::OperateKeystream(KeystreamOperation operation,
const bool xorInput = (operation & INPUT_NULL) != INPUT_NULL;
ChaCha_OperateKeystream_SSE2(m_state, xorInput ? input : NULLPTR, output, m_rounds);
// MultiBlockSafe avoids overflow on the counter words
m_state[12] += 4;
if (m_state[12] < 4)
m_state[13]++;
//if (m_state[12] < 4)
// m_state[13]++;
input += (!!xorInput)*4*BYTES_PER_ITERATION;
output += 4*BYTES_PER_ITERATION;
@ -190,9 +191,10 @@ void ChaCha_Policy::OperateKeystream(KeystreamOperation operation,
const bool xorInput = (operation & INPUT_NULL) != INPUT_NULL;
ChaCha_OperateKeystream_NEON(m_state, xorInput ? input : NULLPTR, output, m_rounds);
// MultiBlockSafe avoids overflow on the counter words
m_state[12] += 4;
if (m_state[12] < 4)
m_state[13]++;
//if (m_state[12] < 4)
// m_state[13]++;
input += (!!xorInput)*4*BYTES_PER_ITERATION;
output += 4*BYTES_PER_ITERATION;
@ -209,9 +211,10 @@ void ChaCha_Policy::OperateKeystream(KeystreamOperation operation,
const bool xorInput = (operation & INPUT_NULL) != INPUT_NULL;
ChaCha_OperateKeystream_POWER8(m_state, xorInput ? input : NULLPTR, output, m_rounds);
// MultiBlockSafe avoids overflow on the counter words
m_state[12] += 4;
if (m_state[12] < 4)
m_state[13]++;
//if (m_state[12] < 4)
// m_state[13]++;
input += (!!xorInput)*4*BYTES_PER_ITERATION;
output += 4*BYTES_PER_ITERATION;