public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH EDK2 v1 0/1] BaseTools/GenFfs: Optimazing else if statement
@ 2020-12-14  3:11 wenyi,xie
  2020-12-14  3:11 ` [PATCH EDK2 v1 1/1] " wenyi,xie
  0 siblings, 1 reply; 4+ messages in thread
From: wenyi,xie @ 2020-12-14  3:11 UTC (permalink / raw)
  To: devel, bob.c.feng, gaoliming, yuwei.chen; +Cc: songdongkuang, xiewenyi2

Main Changes :
When Alignment < 0x400 is false, the expression of Alignment >= 0x400 is
always true. So extract the expression from the 
else if (Alignment >= 0x400statement).

Wenyi Xie (1):
  BaseTools/GenFfs: Optimazing else if statement

 BaseTools/Source/C/GenFfs/GenFfs.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

-- 
2.20.1.windows.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH EDK2 v1 1/1] BaseTools/GenFfs: Optimazing else if statement
  2020-12-14  3:11 [PATCH EDK2 v1 0/1] BaseTools/GenFfs: Optimazing else if statement wenyi,xie
@ 2020-12-14  3:11 ` wenyi,xie
  2020-12-15  4:02   ` Bob Feng
  0 siblings, 1 reply; 4+ messages in thread
From: wenyi,xie @ 2020-12-14  3:11 UTC (permalink / raw)
  To: devel, bob.c.feng, gaoliming, yuwei.chen; +Cc: songdongkuang, xiewenyi2

When Alignment < 0x400 is false, the expression of Alignment >= 0x400 is
always true. So extract the expression from the else if statement.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
 BaseTools/Source/C/GenFfs/GenFfs.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index fcb911f4fc34..70538b138f33 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -821,12 +821,11 @@ Returns:
           if (Alignment < 0x400){
             sprintf (AlignmentBuffer, "%d", Alignment);
           }
-          else if (Alignment >= 0x400) {
-            if (Alignment >= 0x100000) {
+          else if (Alignment >= 0x100000) {
               sprintf (AlignmentBuffer, "%dM", Alignment/0x100000);
-            } else {
+          }
+		  else {
               sprintf (AlignmentBuffer, "%dK", Alignment/0x400);
-            }
           }
           Status = StringtoAlignment (AlignmentBuffer, &(InputFileAlign[InputFileNum]));
         }
-- 
2.20.1.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH EDK2 v1 1/1] BaseTools/GenFfs: Optimazing else if statement
  2020-12-14  3:11 ` [PATCH EDK2 v1 1/1] " wenyi,xie
@ 2020-12-15  4:02   ` Bob Feng
  2020-12-15  4:18     ` wenyi,xie
  0 siblings, 1 reply; 4+ messages in thread
From: Bob Feng @ 2020-12-15  4:02 UTC (permalink / raw)
  To: Wenyi Xie, devel@edk2.groups.io, gaoliming@byosoft.com.cn,
	Chen, Christine
  Cc: songdongkuang@huawei.com

This change makes sense.

Please replace the tab with the space in this patch.
You may need to check your patch with BaseTools\Scripts\PatchCheck.py script before sending the patch review.

Thanks,
Bob

-----Original Message-----
From: Wenyi Xie <xiewenyi2@huawei.com> 
Sent: Monday, December 14, 2020 11:11 AM
To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>; gaoliming@byosoft.com.cn; Chen, Christine <yuwei.chen@intel.com>
Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com
Subject: [PATCH EDK2 v1 1/1] BaseTools/GenFfs: Optimazing else if statement

When Alignment < 0x400 is false, the expression of Alignment >= 0x400 is always true. So extract the expression from the else if statement.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
---
 BaseTools/Source/C/GenFfs/GenFfs.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index fcb911f4fc34..70538b138f33 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -821,12 +821,11 @@ Returns:
           if (Alignment < 0x400){
             sprintf (AlignmentBuffer, "%d", Alignment);
           }
-          else if (Alignment >= 0x400) {
-            if (Alignment >= 0x100000) {
+          else if (Alignment >= 0x100000) {
               sprintf (AlignmentBuffer, "%dM", Alignment/0x100000);
-            } else {
+          }
+		  else {
               sprintf (AlignmentBuffer, "%dK", Alignment/0x400);
-            }
           }
           Status = StringtoAlignment (AlignmentBuffer, &(InputFileAlign[InputFileNum]));
         }
--
2.20.1.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH EDK2 v1 1/1] BaseTools/GenFfs: Optimazing else if statement
  2020-12-15  4:02   ` Bob Feng
@ 2020-12-15  4:18     ` wenyi,xie
  0 siblings, 0 replies; 4+ messages in thread
From: wenyi,xie @ 2020-12-15  4:18 UTC (permalink / raw)
  To: Feng, Bob C, devel@edk2.groups.io, gaoliming@byosoft.com.cn,
	Chen, Christine
  Cc: songdongkuang@huawei.com

OK, I will remove the tab and send new patch soon.

Thanks
Wenyi

On 2020/12/15 12:02, Feng, Bob C wrote:
> This change makes sense.
> 
> Please replace the tab with the space in this patch.
> You may need to check your patch with BaseTools\Scripts\PatchCheck.py script before sending the patch review.
> 
> Thanks,
> Bob
> 
> -----Original Message-----
> From: Wenyi Xie <xiewenyi2@huawei.com> 
> Sent: Monday, December 14, 2020 11:11 AM
> To: devel@edk2.groups.io; Feng, Bob C <bob.c.feng@intel.com>; gaoliming@byosoft.com.cn; Chen, Christine <yuwei.chen@intel.com>
> Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com
> Subject: [PATCH EDK2 v1 1/1] BaseTools/GenFfs: Optimazing else if statement
> 
> When Alignment < 0x400 is false, the expression of Alignment >= 0x400 is always true. So extract the expression from the else if statement.
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
> ---
>  BaseTools/Source/C/GenFfs/GenFfs.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
> index fcb911f4fc34..70538b138f33 100644
> --- a/BaseTools/Source/C/GenFfs/GenFfs.c
> +++ b/BaseTools/Source/C/GenFfs/GenFfs.c
> @@ -821,12 +821,11 @@ Returns:
>            if (Alignment < 0x400){
>              sprintf (AlignmentBuffer, "%d", Alignment);
>            }
> -          else if (Alignment >= 0x400) {
> -            if (Alignment >= 0x100000) {
> +          else if (Alignment >= 0x100000) {
>                sprintf (AlignmentBuffer, "%dM", Alignment/0x100000);
> -            } else {
> +          }
> +		  else {
>                sprintf (AlignmentBuffer, "%dK", Alignment/0x400);
> -            }
>            }
>            Status = StringtoAlignment (AlignmentBuffer, &(InputFileAlign[InputFileNum]));
>          }
> --
> 2.20.1.windows.1
> 
> .
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-15  4:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-14  3:11 [PATCH EDK2 v1 0/1] BaseTools/GenFfs: Optimazing else if statement wenyi,xie
2020-12-14  3:11 ` [PATCH EDK2 v1 1/1] " wenyi,xie
2020-12-15  4:02   ` Bob Feng
2020-12-15  4:18     ` wenyi,xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox