fdr: use braced init syntax for pairs

This commit is contained in:
Justin Viiret 2016-04-29 09:40:44 +10:00 committed by Matthew Barr
parent b8cd169cde
commit ad74f3b895
4 changed files with 8 additions and 8 deletions

View File

@ -315,12 +315,12 @@ void FDRCompiler::assignStringsToBuckets() {
for (u32 k = j; k < nChunks; ++k) { for (u32 k = j; k < nChunks; ++k) {
cnt += count[k]; cnt += count[k];
} }
t[j][0] = make_pair(getScoreUtil(length[j], cnt), 0); t[j][0] = {getScoreUtil(length[j], cnt), 0};
} }
for (u32 i = 1; i < nb; i++) { for (u32 i = 1; i < nb; i++) {
for (u32 j = 0; j < nChunks - 1; j++) { // don't process last, empty row for (u32 j = 0; j < nChunks - 1; j++) { // don't process last, empty row
SCORE_INDEX_PAIR best = make_pair(MAX_SCORE, 0); SCORE_INDEX_PAIR best = {MAX_SCORE, 0};
u32 cnt = count[j]; u32 cnt = count[j];
for (u32 k = j + 1; k < nChunks - 1; k++, cnt += count[k]) { for (u32 k = j + 1; k < nChunks - 1; k++, cnt += count[k]) {
SCORE score = getScoreUtil(length[j], cnt); SCORE score = getScoreUtil(length[j], cnt);
@ -329,12 +329,12 @@ void FDRCompiler::assignStringsToBuckets() {
} }
score += t[k][i-1].first; score += t[k][i-1].first;
if (score < best.first) { if (score < best.first) {
best = make_pair(score, k); best = {score, k};
} }
} }
t[j][i] = best; t[j][i] = best;
} }
t[nChunks - 1][i] = make_pair(0,0); // fill in empty final row for next iteration t[nChunks - 1][i] = {0,0}; // fill in empty final row for next iteration
} }
#ifdef DEBUG_ASSIGNMENT #ifdef DEBUG_ASSIGNMENT

View File

@ -472,7 +472,7 @@ setupFullMultiConfs(const vector<hwlmLiteral> &lits,
u32 idx = c * nBuckets + b; u32 idx = c * nBuckets + b;
confBase[idx] = confirm_offset; confBase[idx] = confirm_offset;
} }
return make_pair(move(buf), totalSize); return {move(buf), totalSize};
} }
} // namespace ue2 } // namespace ue2

View File

@ -320,7 +320,7 @@ fdrBuildTableStreaming(const vector<hwlmLiteral> &lits,
stream_control.literal_history_required = stream_control.literal_history_required =
max(maxLen(lits), max_mask_len) - 1; max(maxLen(lits), max_mask_len) - 1;
stream_control.literal_stream_state_required = 0; stream_control.literal_stream_state_required = 0;
return make_pair(nullptr, size_t{0}); return {nullptr, size_t{0}};
} }
// Ensure that we have enough room for the longest mask. // Ensure that we have enough room for the longest mask.
@ -419,7 +419,7 @@ fdrBuildTableStreaming(const vector<hwlmLiteral> &lits,
// tell the world what we did // tell the world what we did
stream_control.literal_history_required = max_len; stream_control.literal_history_required = max_len;
stream_control.literal_stream_state_required = tot_state_bytes; stream_control.literal_stream_state_required = tot_state_bytes;
return make_pair(move(secondaryTable), tabSize); return {move(secondaryTable), tabSize};
} }
} // namespace ue2 } // namespace ue2

View File

@ -217,7 +217,7 @@ setupFDRFloodControl(const vector<hwlmLiteral> &lits,
DEBUG_PRINTF("made a flood structure with %zu + %zu = %zu\n", DEBUG_PRINTF("made a flood structure with %zu + %zu = %zu\n",
floodHeaderSize, floodStructSize, totalSize); floodHeaderSize, floodStructSize, totalSize);
return make_pair(move(buf), totalSize); return {move(buf), totalSize};
} }
} // namespace ue2 } // namespace ue2