From 7e18dfe885f1cf2924078542927496c35d575ce7 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Tue, 28 Nov 2017 17:08:00 +0000 Subject: [PATCH] Tweaked C code to be slightly more efficient by using static constant data. --- c/qrcodegen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/c/qrcodegen.c b/c/qrcodegen.c index 614d9af..09ba8a5 100644 --- a/c/qrcodegen.c +++ b/c/qrcodegen.c @@ -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); }