Skip to content

Commit

Permalink
IntegerMatcher: Fix data type of loop counters
Browse files Browse the repository at this point in the history
ClassTemplate->ProtoLengths[n] is of type uint8_t, so use that for
the related loop counters, too.

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Mar 24, 2019
1 parent f4f34a8 commit 509ee95
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/classify/intmatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ int IntegerMatcher::FindGoodProtos(
for (int proto = 0; proto < ClassTemplate->NumProtos; proto++) {
/* Compute Average for Actual Proto */
int Temp = 0;
for (int i = 0; i < ClassTemplate->ProtoLengths[proto]; i++)
for (uint8_t i = 0; i < ClassTemplate->ProtoLengths[proto]; i++)
Temp += tables->proto_evidence_[proto][i];

Temp /= ClassTemplate->ProtoLengths[proto];
Expand Down Expand Up @@ -894,7 +894,7 @@ int IntegerMatcher::UpdateTablesForFeature(

uint8_t* UINT8Pointer =
&(tables->proto_evidence_[ActualProtoNum + proto_offset][0]);
for (int ProtoIndex =
for (uint8_t ProtoIndex =
ClassTemplate->ProtoLengths[ActualProtoNum + proto_offset];
ProtoIndex > 0; ProtoIndex--, UINT8Pointer++) {
if (Evidence > *UINT8Pointer) {
Expand Down Expand Up @@ -997,7 +997,7 @@ void IntegerMatcher::DebugFeatureProtoError(
ProtoNum++, ActualProtoNum++) {
cprintf ("P %3d =", ActualProtoNum);
int temp = 0;
for (int j = 0; j < ClassTemplate->ProtoLengths[ActualProtoNum]; j++) {
for (uint8_t j = 0; j < ClassTemplate->ProtoLengths[ActualProtoNum]; j++) {
uint8_t data = tables.proto_evidence_[ActualProtoNum][j];
cprintf(" %d", data);
temp += data;
Expand Down Expand Up @@ -1071,7 +1071,7 @@ void IntegerMatcher::DisplayProtoDebugInfo(
ProtoNum++, ActualProtoNum++) {
/* Compute Average for Actual Proto */
int temp = 0;
for (int i = 0; i < ClassTemplate->ProtoLengths[ActualProtoNum]; i++)
for (uint8_t i = 0; i < ClassTemplate->ProtoLengths[ActualProtoNum]; i++)
temp += tables.proto_evidence_[ActualProtoNum][i];

temp /= ClassTemplate->ProtoLengths[ActualProtoNum];
Expand Down Expand Up @@ -1153,7 +1153,7 @@ void ScratchEvidence::UpdateSumOfProtoEvidences(
((ProtoNum < PROTOS_PER_PROTO_SET) && (ActualProtoNum < NumProtos));
ProtoNum++, ActualProtoNum++) {
int temp = 0;
for (int i = 0; i < ClassTemplate->ProtoLengths[ActualProtoNum]; i++)
for (uint8_t i = 0; i < ClassTemplate->ProtoLengths[ActualProtoNum]; i++)
temp += proto_evidence_[ActualProtoNum] [i];

ConfigWord = ProtoSet->Protos[ProtoNum].Configs[0];
Expand Down

0 comments on commit 509ee95

Please sign in to comment.