only return UNKNOWN_CONTAINS_CAPS when everything else is equal

parent 3cf0023c
...@@ -105,6 +105,7 @@ StructEqualityResult AnyStruct::Reader::equals(AnyStruct::Reader right) { ...@@ -105,6 +105,7 @@ StructEqualityResult AnyStruct::Reader::equals(AnyStruct::Reader right) {
size_t i = 0; size_t i = 0;
auto eqResult = StructEqualityResult::EQUAL;
for(; i < kj::min(ptrsL.size(), ptrsR.size()); i++) { for(; i < kj::min(ptrsL.size(), ptrsR.size()); i++) {
auto l = ptrsL[i]; auto l = ptrsL[i];
auto r = ptrsR[i]; auto r = ptrsR[i];
...@@ -114,12 +115,14 @@ StructEqualityResult AnyStruct::Reader::equals(AnyStruct::Reader right) { ...@@ -114,12 +115,14 @@ StructEqualityResult AnyStruct::Reader::equals(AnyStruct::Reader right) {
case StructEqualityResult::NOT_EQUAL: case StructEqualityResult::NOT_EQUAL:
return StructEqualityResult::NOT_EQUAL; return StructEqualityResult::NOT_EQUAL;
case StructEqualityResult::UNKNOWN_CONTAINS_CAPS: case StructEqualityResult::UNKNOWN_CONTAINS_CAPS:
return StructEqualityResult::UNKNOWN_CONTAINS_CAPS; eqResult = StructEqualityResult::UNKNOWN_CONTAINS_CAPS;
break;
default:
KJ_UNREACHABLE;
} }
} }
return StructEqualityResult::EQUAL; return eqResult;
} }
kj::StringPtr KJ_STRINGIFY(StructEqualityResult res) { kj::StringPtr KJ_STRINGIFY(StructEqualityResult res) {
...@@ -130,6 +133,8 @@ kj::StringPtr KJ_STRINGIFY(StructEqualityResult res) { ...@@ -130,6 +133,8 @@ kj::StringPtr KJ_STRINGIFY(StructEqualityResult res) {
return "EQUAL"; return "EQUAL";
case StructEqualityResult::UNKNOWN_CONTAINS_CAPS: case StructEqualityResult::UNKNOWN_CONTAINS_CAPS:
return "UNKNOWN_CONTAINS_CAPS"; return "UNKNOWN_CONTAINS_CAPS";
default:
KJ_UNREACHABLE;
} }
} }
...@@ -137,6 +142,7 @@ StructEqualityResult AnyList::Reader::equals(AnyList::Reader right) { ...@@ -137,6 +142,7 @@ StructEqualityResult AnyList::Reader::equals(AnyList::Reader right) {
if(size() != right.size()) { if(size() != right.size()) {
return StructEqualityResult::NOT_EQUAL; return StructEqualityResult::NOT_EQUAL;
} }
auto eqResult = StructEqualityResult::EQUAL;
switch(getElementSize()) { switch(getElementSize()) {
case ElementSize::VOID: case ElementSize::VOID:
case ElementSize::BIT: case ElementSize::BIT:
...@@ -164,11 +170,16 @@ StructEqualityResult AnyList::Reader::equals(AnyList::Reader right) { ...@@ -164,11 +170,16 @@ StructEqualityResult AnyList::Reader::equals(AnyList::Reader right) {
case StructEqualityResult::NOT_EQUAL: case StructEqualityResult::NOT_EQUAL:
return StructEqualityResult::NOT_EQUAL; return StructEqualityResult::NOT_EQUAL;
case StructEqualityResult::UNKNOWN_CONTAINS_CAPS: case StructEqualityResult::UNKNOWN_CONTAINS_CAPS:
return StructEqualityResult::UNKNOWN_CONTAINS_CAPS; eqResult = StructEqualityResult::UNKNOWN_CONTAINS_CAPS;
break;
default:
KJ_UNREACHABLE;
} }
} }
return StructEqualityResult::EQUAL; return eqResult;
} }
default:
KJ_UNREACHABLE;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment