Make some style corrections

Co-Authored-By: Rangi <remy.oukaour+rangi42@gmail.com>
This commit is contained in:
ISSOtm
2022-03-14 21:31:46 +01:00
committed by Eldred Habert
parent e49fb457ea
commit 6ed220b4c1
5 changed files with 39 additions and 43 deletions

View File

@@ -211,14 +211,14 @@ public:
// NOTE: this function must not call `uniqueColors`, or one of its callers will break!
double relSize = 0.;
for (uint16_t color : protoPal) {
auto n = std::count_if(begin(), end(), [this, &color](ProtoPalAttrs const &attrs) {
ProtoPalette const &pal = (*_protoPals)[attrs.protoPalIndex];
return std::find(pal.begin(), pal.end(), color) != pal.end();
});
// NOTE: The paper and the associated code disagree on this: the code has
// this `1 +`, whereas the paper does not; its lack causes a division by 0
// if the symbol is not found anywhere, so I'm assuming the paper is wrong.
relSize +=
1. / (1 + std::count_if(begin(), end(), [this, &color](ProtoPalAttrs const &attrs) {
ProtoPalette const &pal = (*_protoPals)[attrs.protoPalIndex];
return std::find(pal.begin(), pal.end(), color) != pal.end();
}));
relSize += 1. / (1 + n);
}
return relSize;
}