Use 8-bit instead of 16-bit loop indices where they will suffice

This commit is contained in:
Eric Tang
2017-08-08 17:23:11 -07:00
parent 2b97758ad2
commit 7306073cee
2 changed files with 5 additions and 5 deletions

View File

@@ -27,7 +27,7 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
uint16_t keymapCount; uint16_t keymapCount;
(void)dataModelVersion; (void)dataModelVersion;
for (uint16_t moduleConfigurationIdx = 0; moduleConfigurationIdx < moduleConfigurationCount; moduleConfigurationIdx++) { for (uint8_t moduleConfigurationIdx = 0; moduleConfigurationIdx < moduleConfigurationCount; moduleConfigurationIdx++) {
errorCode = parseModuleConfiguration(buffer); errorCode = parseModuleConfiguration(buffer);
if (errorCode != ParserError_Success) { if (errorCode != ParserError_Success) {
return errorCode; return errorCode;
@@ -41,7 +41,7 @@ parser_error_t ParseConfig(config_buffer_t *buffer)
} }
} }
keymapCount = readCompactLength(buffer); keymapCount = readCompactLength(buffer);
for (uint16_t keymapIdx = 0; keymapIdx < keymapCount; keymapIdx++) { for (uint8_t keymapIdx = 0; keymapIdx < keymapCount; keymapIdx++) {
errorCode = ParseKeymap(buffer, keymapIdx, keymapCount); errorCode = ParseKeymap(buffer, keymapIdx, keymapCount);
if (errorCode != ParserError_Success) { if (errorCode != ParserError_Success) {
return errorCode; return errorCode;

View File

@@ -157,7 +157,7 @@ static parser_error_t parseKeyActions(uint8_t targetLayer, config_buffer_t *buff
if (actionCount > MAX_KEY_COUNT_PER_MODULE) { if (actionCount > MAX_KEY_COUNT_PER_MODULE) {
return ParserError_InvalidActionCount; return ParserError_InvalidActionCount;
} }
for (uint16_t actionIdx = 0; actionIdx < actionCount; actionIdx++) { for (uint8_t actionIdx = 0; actionIdx < actionCount; actionIdx++) {
errorCode = parseKeyAction(ParserRunDry ? &dummyKeyAction : &CurrentKeymap[targetLayer][moduleId][actionIdx], buffer); errorCode = parseKeyAction(ParserRunDry ? &dummyKeyAction : &CurrentKeymap[targetLayer][moduleId][actionIdx], buffer);
if (errorCode != ParserError_Success) { if (errorCode != ParserError_Success) {
return errorCode; return errorCode;
@@ -182,7 +182,7 @@ static parser_error_t parseLayer(config_buffer_t *buffer, uint8_t layer)
if (moduleCount > SLOT_COUNT) { if (moduleCount > SLOT_COUNT) {
return ParserError_InvalidModuleCount; return ParserError_InvalidModuleCount;
} }
for (uint16_t moduleIdx = 0; moduleIdx < moduleCount; moduleIdx++) { for (uint8_t moduleIdx = 0; moduleIdx < moduleCount; moduleIdx++) {
errorCode = parseModule(buffer, layer); errorCode = parseModule(buffer, layer);
if (errorCode != ParserError_Success) { if (errorCode != ParserError_Success) {
return errorCode; return errorCode;
@@ -217,7 +217,7 @@ parser_error_t ParseKeymap(config_buffer_t *buffer, uint8_t keymapIdx, uint8_t k
} }
} }
tempKeymapCount = keymapCount; tempKeymapCount = keymapCount;
for (uint16_t layerIdx = 0; layerIdx < layerCount; layerIdx++) { for (uint8_t layerIdx = 0; layerIdx < layerCount; layerIdx++) {
errorCode = parseLayer(buffer, layerIdx); errorCode = parseLayer(buffer, layerIdx);
if (errorCode != ParserError_Success) { if (errorCode != ParserError_Success) {
return errorCode; return errorCode;