MCPcopy Create free account
hub / github.com/devilsen/CZXing / ChecksumIsValid

Function ChecksumIsValid

czxing/src/main/cpp/zxing/src/oned/ODDataBarReader.cpp:123–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123static bool ChecksumIsValid(Pair leftPair, Pair rightPair)
124{
125 auto checksum = [](Pair p) { return p.left.checksum + 4 * p.right.checksum; };
126 int a = (checksum(leftPair) + 16 * checksum(rightPair)) % 79;
127 int b = 9 * (std::abs(leftPair.finder) - 1) + (std::abs(rightPair.finder) - 1);
128 if (b > 72)
129 b--;
130 if (b > 8)
131 b--;
132 return a == b;
133}
134
135static std::string ConstructText(Pair leftPair, Pair rightPair)
136{

Callers 1

decodePatternMethod · 0.70

Calls 1

absFunction · 0.50

Tested by

no test coverage detected