public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Bob Feng" <bob.c.feng@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Feng, Bob C" <bob.c.feng@intel.com>,
	"xiewenyi2@huawei.com" <xiewenyi2@huawei.com>,
	"gaoliming@byosoft.com.cn" <gaoliming@byosoft.com.cn>,
	"Chen, Christine" <yuwei.chen@intel.com>
Cc: "songdongkuang@huawei.com" <songdongkuang@huawei.com>
Subject: Re: [edk2-devel] [PATCH EDK2 v2 1/1] BaseTools/GenFfs: Optimazing else if statement
Date: Mon, 21 Dec 2020 02:27:44 +0000	[thread overview]
Message-ID: <DM6PR11MB4073AAEB38E02471BFF5FCF6C9C00@DM6PR11MB4073.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1652993EE39DFAF7.21743@groups.io>

Created a PR https://github.com/tianocore/edk2/pull/1250


-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob Feng
Sent: Monday, December 21, 2020 10:07 AM
To: devel@edk2.groups.io; xiewenyi2@huawei.com; gaoliming@byosoft.com.cn; Chen, Christine <yuwei.chen@intel.com>
Cc: songdongkuang@huawei.com
Subject: Re: [edk2-devel] [PATCH EDK2 v2 1/1] BaseTools/GenFfs: Optimazing else if statement

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of wenyi,xie via groups.io
Sent: Tuesday, December 15, 2020 2:31 PM
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: [edk2-devel] [PATCH EDK2 v2 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 | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index fcb911f4fc34..949025c33325 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) {
-              sprintf (AlignmentBuffer, "%dM", Alignment/0x100000);
-            } else {
-              sprintf (AlignmentBuffer, "%dK", Alignment/0x400);
-            }
+          else if (Alignment >= 0x100000) {
+            sprintf (AlignmentBuffer, "%dM", Alignment/0x100000);
+          }
+          else {
+            sprintf (AlignmentBuffer, "%dK", Alignment/0x400);
           }
           Status = StringtoAlignment (AlignmentBuffer, &(InputFileAlign[InputFileNum]));
         }
--
2.20.1.windows.1












      parent reply	other threads:[~2020-12-21  2:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15  6:30 [PATCH EDK2 v2 0/1] BaseTools/GenFfs: Optimazing else if statement wenyi,xie
2020-12-15  6:30 ` [PATCH EDK2 v2 1/1] " wenyi,xie
2020-12-21  2:07   ` [edk2-devel] " Bob Feng
     [not found]   ` <1652993EE39DFAF7.21743@groups.io>
2020-12-21  2:27     ` Bob Feng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR11MB4073AAEB38E02471BFF5FCF6C9C00@DM6PR11MB4073.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox