Skip to content

Commit c88d8bb

Browse files
maninder42sfrothwell
authored andcommitted
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, torvalds#256 ; 0x100 changed: e92ddbf0 push {r4, r5, r6, r7, r8, r9, fp, ip, lr, pc} e24cb004 sub fp, ip, #4 e24dd080 sub sp, sp, torvalds#128 ; 0x80 Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Maninder Singh <[email protected]> Signed-off-by: Vaneet Narang <[email protected]> Cc: Amit Sahrawat <[email protected]> Cc: David S. Miller <[email protected]> Cc: Gustavo A. R. Silva <[email protected]> Cc: Herbert Xu <[email protected]> Cc: Joe Perches <[email protected]> Cc: Kees Cook <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Stephen Rothwell <[email protected]>
1 parent 3a42bcf commit c88d8bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/zstd/huf_compress.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ static U32 HUF_setMaxHeight(nodeElt *huffNode, U32 lastNonNull, U32 maxNbBits)
382382
}
383383

384384
typedef struct {
385-
U32 base;
386-
U32 curr;
385+
U16 base;
386+
U16 curr;
387387
} rankPos;
388388

389389
static void HUF_sort(nodeElt *huffNode, const U32 *count, U32 maxSymbolValue)

0 commit comments

Comments
 (0)