* [PATCH] BaseTools/LzmaCompress: Fix the option "d" dictionary size
@ 2019-09-30 3:52 Zhang, Shenglei
2019-09-30 5:17 ` Liming Gao
0 siblings, 1 reply; 2+ messages in thread
From: Zhang, Shenglei @ 2019-09-30 3:52 UTC (permalink / raw)
To: devel; +Cc: Bob Feng, Liming Gao
The range of dictionary size is set from [0,30] to [0,27].
And update the help information for this.
The previous logic for processing the parameter dict size is incorrect.
Now fix the logic.
The option "d" is added at 6b80310f34199d1f62e45e40fa902734735091fa.
(https://bugzilla.tianocore.org/show_bug.cgi?id=2077)
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
BaseTools/Source/C/LzmaCompress/LzmaCompress.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
index 856fcf9ffb17..bebdb9aa84a1 100644
--- a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
+++ b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
@@ -42,7 +42,7 @@ const char *kInvalidParamValMessage = "Invalid parameter value";
static Bool mQuietMode = False;
static CONVERTER_TYPE mConType = NoConverter;
-UINT64 mDictionarySize = 31;
+UINT64 mDictionarySize = 28;
UINT64 mCompressionMode = 2;
#define UTILITY_NAME "LzmaCompress"
@@ -64,7 +64,7 @@ void PrintHelp(char *buffer)
" -q, --quiet: reduce output messages\n"
" --debug [0-9]: set debug level\n"
" -a: set compression mode 0 = fast, 1 = normal, default: 1 (normal)\n"
- " d: sets Dictionary size - [0, 30], default: 23 (8MB)\n"
+ " d: sets Dictionary size - [0, 27], default: 24 (16MB)\n"
" --version: display the program version and exit\n"
" -h, --help: display this help text\n"
);
@@ -298,8 +298,12 @@ int main2(int numArgs, const char *args[], char *rs)
}
} else if (strcmp(args[param], "d") == 0) {
AsciiStringToUint64(args[param + 1],FALSE,&mDictionarySize);
- if (mDictionarySize <= 30){
- props.dictSize = (UINT32)mDictionarySize;
+ if (mDictionarySize <= 27) {
+ if (mDictionarySize == 0) {
+ props.dictSize = 0;
+ } else {
+ props.dictSize = (1 << mDictionarySize);
+ }
param++;
continue;
} else {
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] BaseTools/LzmaCompress: Fix the option "d" dictionary size
2019-09-30 3:52 [PATCH] BaseTools/LzmaCompress: Fix the option "d" dictionary size Zhang, Shenglei
@ 2019-09-30 5:17 ` Liming Gao
0 siblings, 0 replies; 2+ messages in thread
From: Liming Gao @ 2019-09-30 5:17 UTC (permalink / raw)
To: Zhang, Shenglei, devel@edk2.groups.io; +Cc: Feng, Bob C
Reviewed-by: Liming Gao <liming.gao@intel.com>
>-----Original Message-----
>From: Zhang, Shenglei
>Sent: Monday, September 30, 2019 11:52 AM
>To: devel@edk2.groups.io
>Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [PATCH] BaseTools/LzmaCompress: Fix the option "d" dictionary size
>
>The range of dictionary size is set from [0,30] to [0,27].
>And update the help information for this.
>The previous logic for processing the parameter dict size is incorrect.
>Now fix the logic.
>The option "d" is added at 6b80310f34199d1f62e45e40fa902734735091fa.
>(https://bugzilla.tianocore.org/show_bug.cgi?id=2077)
>
>Cc: Bob Feng <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
>---
> BaseTools/Source/C/LzmaCompress/LzmaCompress.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
>diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
>b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
>index 856fcf9ffb17..bebdb9aa84a1 100644
>--- a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
>+++ b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
>@@ -42,7 +42,7 @@ const char *kInvalidParamValMessage = "Invalid
>parameter value";
> static Bool mQuietMode = False;
> static CONVERTER_TYPE mConType = NoConverter;
>
>-UINT64 mDictionarySize = 31;
>+UINT64 mDictionarySize = 28;
> UINT64 mCompressionMode = 2;
>
> #define UTILITY_NAME "LzmaCompress"
>@@ -64,7 +64,7 @@ void PrintHelp(char *buffer)
> " -q, --quiet: reduce output messages\n"
> " --debug [0-9]: set debug level\n"
> " -a: set compression mode 0 = fast, 1 = normal, default: 1 (normal)\n"
>- " d: sets Dictionary size - [0, 30], default: 23 (8MB)\n"
>+ " d: sets Dictionary size - [0, 27], default: 24 (16MB)\n"
> " --version: display the program version and exit\n"
> " -h, --help: display this help text\n"
> );
>@@ -298,8 +298,12 @@ int main2(int numArgs, const char *args[], char *rs)
> }
> } else if (strcmp(args[param], "d") == 0) {
> AsciiStringToUint64(args[param + 1],FALSE,&mDictionarySize);
>- if (mDictionarySize <= 30){
>- props.dictSize = (UINT32)mDictionarySize;
>+ if (mDictionarySize <= 27) {
>+ if (mDictionarySize == 0) {
>+ props.dictSize = 0;
>+ } else {
>+ props.dictSize = (1 << mDictionarySize);
>+ }
> param++;
> continue;
> } else {
>--
>2.18.0.windows.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-30 5:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-30 3:52 [PATCH] BaseTools/LzmaCompress: Fix the option "d" dictionary size Zhang, Shenglei
2019-09-30 5:17 ` Liming Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox