Simplified a bit of C code.

This commit is contained in:
Project Nayuki 2017-09-09 05:46:24 +00:00
parent 2b9770f54a
commit e36f6953dc
1 changed files with 2 additions and 2 deletions

View File

@ -990,9 +990,9 @@ testable int getTotalBits(const struct qrcodegen_Segment segs[], size_t len, int
int ccbits = numCharCountBits(segs[i].mode, version);
assert(0 <= ccbits && ccbits <= 16);
// 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;
long temp = 4L + ccbits + segs[i].bitLength;
long temp = 4L + ccbits + bitLength;
if (temp > INT16_MAX - result)
return -1;
result += temp;