[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1559552526-4317-3-git-send-email-maninder1.s@samsung.com>
Date:   Mon,  3 Jun 2019 14:32:04 +0530
From:   Maninder Singh <maninder1.s@...sung.com>
To:     akpm@...ux-foundation.org, herbert@...dor.apana.org.au,
        davem@...emloft.net, keescook@...omium.org, gustavo@...eddedor.com
Cc:     joe@...ches.com, linux-crypto@...r.kernel.org,
        linux-kernel@...r.kernel.org, a.sahrawat@...sung.com,
        pankaj.m@...sung.com, v.narang@...sung.com,
        Maninder Singh <maninder1.s@...sung.com>
Subject: [PATCH 2/4] zstd: use U16 data type for rankPos
rankPos structure variables value can not be more than 512.
So it can easily be declared as U16 rather than U32.
It will reduce stack usage of HUF_sort from 256 bytes to 128 bytes
original:
e92ddbf0        push    {r4, r5, r6, r7, r8, r9, fp, ip, lr, pc}
e24cb004        sub     fp, ip, #4
e24ddc01        sub     sp, sp, #256    ; 0x100
changed:
e92ddbf0        push    {r4, r5, r6, r7, r8, r9, fp, ip, lr, pc}
e24cb004        sub     fp, ip, #4
e24dd080        sub     sp, sp, #128    ; 0x80
Signed-off-by: Maninder Singh <maninder1.s@...sung.com>
Signed-off-by: Vaneet Narang <v.narang@...sung.com>
---
 lib/zstd/huf_compress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
index e727812..2203124 100644
--- a/lib/zstd/huf_compress.c
+++ b/lib/zstd/huf_compress.c
@@ -382,8 +382,8 @@ static U32 HUF_setMaxHeight(nodeElt *huffNode, U32 lastNonNull, U32 maxNbBits)
 }
 
 typedef struct {
-	U32 base;
-	U32 curr;
+	U16 base;
+	U16 curr;
 } rankPos;
 
 static void HUF_sort(nodeElt *huffNode, const U32 *count, U32 maxSymbolValue)
-- 
2.7.4
Powered by blists - more mailing lists