Simplified a bit of C code.

pull/18/head
Project Nayuki 7 years ago
parent 2b9770f54a
commit e36f6953dc

@ -990,9 +990,9 @@ testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int
int ccbits = numCharCountBits(segs[i].mode, version); int ccbits = numCharCountBits(segs[i].mode, version);
assert(0 <= ccbits && ccbits <= 16); assert(0 <= ccbits && ccbits <= 16);
// Fail if segment length value doesn't fit in the length field's bit-width // Fail if segment length value doesn't fit in the length field's bit-width
if (segs[i].numChars >= (1L << ccbits)) if (numChars >= (1L << ccbits))
return -1; return -1;
long temp = 4L + ccbits + segs[i].bitLength; long temp = 4L + ccbits + bitLength;
if (temp > INT16_MAX - result) if (temp > INT16_MAX - result)
return -1; return -1;
result += temp; result += temp;

Loading…
Cancel
Save