Tweaked C code to be slightly more efficient by using static constant data.

This commit is contained in:
Project Nayuki 2017-11-28 17:08:00 +00:00
parent 30a9474596
commit 7e18dfe885
1 changed files with 4 additions and 4 deletions

View File

@ -1013,10 +1013,10 @@ static int numCharCountBits(enum qrcodegen_Mode mode, int version) {
else assert(false);
switch (mode) {
case qrcodegen_Mode_NUMERIC : { const int temp[] = {10, 12, 14}; return temp[i]; }
case qrcodegen_Mode_ALPHANUMERIC: { const int temp[] = { 9, 11, 13}; return temp[i]; }
case qrcodegen_Mode_BYTE : { const int temp[] = { 8, 16, 16}; return temp[i]; }
case qrcodegen_Mode_KANJI : { const int temp[] = { 8, 10, 12}; return temp[i]; }
case qrcodegen_Mode_NUMERIC : { static const int temp[] = {10, 12, 14}; return temp[i]; }
case qrcodegen_Mode_ALPHANUMERIC: { static const int temp[] = { 9, 11, 13}; return temp[i]; }
case qrcodegen_Mode_BYTE : { static const int temp[] = { 8, 16, 16}; return temp[i]; }
case qrcodegen_Mode_KANJI : { static const int temp[] = { 8, 10, 12}; return temp[i]; }
case qrcodegen_Mode_ECI : return 0;
default: assert(false);
}