diff options
| author | Colin Ian King <colin.king@canonical.com> | 2017-10-03 19:16:01 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-03 20:54:25 -0400 |
| commit | 8cb5d7482810b7eb1bb05bf4f71bc93ce35e5896 (patch) | |
| tree | ee9acad7dbfc98ab7e3f7c7259555f6eb50a3edb /lib | |
| parent | 50097f74934e3ec8fb1e6f3087568b958972817d (diff) | |
lib/lz4: make arrays static const, reduces object code size
Don't populate the read-only arrays dec32table and dec64table on the
stack, instead make them both static const. Makes the object code
smaller by over 10K bytes:
Before:
text data bss dec hex filename
31500 0 0 31500 7b0c lib/lz4/lz4_decompress.o
After:
text data bss dec hex filename
20237 176 0 20413 4fbd lib/lz4/lz4_decompress.o
(gcc version 7.2.0 x86_64)
Link: http://lkml.kernel.org/r/20170921221939.20820-1-colin.king@canonical.com
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Sven Schmidt <4sschmid@informatik.uni-hamburg.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/lz4/lz4_decompress.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index bd3574312b82..141734d255e4 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c | |||
| @@ -85,8 +85,8 @@ static FORCE_INLINE int LZ4_decompress_generic( | |||
| 85 | const BYTE * const lowLimit = lowPrefix - dictSize; | 85 | const BYTE * const lowLimit = lowPrefix - dictSize; |
| 86 | 86 | ||
| 87 | const BYTE * const dictEnd = (const BYTE *)dictStart + dictSize; | 87 | const BYTE * const dictEnd = (const BYTE *)dictStart + dictSize; |
| 88 | const unsigned int dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 }; | 88 | static const unsigned int dec32table[] = { 0, 1, 2, 1, 4, 4, 4, 4 }; |
| 89 | const int dec64table[] = { 0, 0, 0, -1, 0, 1, 2, 3 }; | 89 | static const int dec64table[] = { 0, 0, 0, -1, 0, 1, 2, 3 }; |
| 90 | 90 | ||
| 91 | const int safeDecode = (endOnInput == endOnInputSize); | 91 | const int safeDecode = (endOnInput == endOnInputSize); |
| 92 | const int checkOffset = ((safeDecode) && (dictSize < (int)(64 * KB))); | 92 | const int checkOffset = ((safeDecode) && (dictSize < (int)(64 * KB))); |
