Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1737567
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] lib: zstd: make const array rtbTable static, reduces object code size |
| Date | 2017-09-22 17:00 +0200 |
| Message-ID | <usxAS-7iO-11@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
From: Colin Ian King <colin.king@canonical.com>
Don't populate const array rtbTable on the stack, instead make it
static. Also split overly long line to clean a chechkpach warning.
Makes the object code smaller by nearly 500 bytes:
Before:
text data bss dec hex filename
13297 104 0 13401 3459 lib/zstd/fse_compress.o
After:
text data bss dec hex filename
12742 160 0 12902 3266 lib/zstd/fse_compress.o
(gcc 6.3.0, x86-64)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
lib/zstd/fse_compress.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/zstd/fse_compress.c b/lib/zstd/fse_compress.c
index ef3d1741d532..f41c13128ed2 100644
--- a/lib/zstd/fse_compress.c
+++ b/lib/zstd/fse_compress.c
@@ -618,7 +618,10 @@ size_t FSE_normalizeCount(short *normalizedCounter, unsigned tableLog, const uns
return ERROR(GENERIC); /* Too small tableLog, compression potentially impossible */
{
- U32 const rtbTable[] = {0, 473195, 504333, 520860, 550000, 700000, 750000, 830000};
+ U32 static const rtbTable[] = {
+ 0, 473195, 504333, 520860,
+ 550000, 700000, 750000, 830000
+ };
U64 const scale = 62 - tableLog;
U64 const step = div_u64((U64)1 << 62, (U32)total); /* <== here, one division ! */
U64 const vStep = 1ULL << (scale - 20);
--
2.14.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] lib: zstd: make const array rtbTable static, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-22 17:00 +0200
Re: [PATCH] lib: zstd: make const array rtbTable static, reduces object code size Nick Terrell <terrelln@fb.com> - 2017-09-22 21:20 +0200
Re: [PATCH] lib: zstd: make const array rtbTable static, reduces object code size Colin Ian King <colin.king@canonical.com> - 2017-09-22 23:40 +0200
csiph-web