From: "wenyi,xie" <xiewenyi2@huawei.com>
To: <devel@edk2.groups.io>, <bob.c.feng@intel.com>,
<gaoliming@byosoft.com.cn>, <yuwei.chen@intel.com>
Cc: <songdongkuang@huawei.com>, <xiewenyi2@huawei.com>
Subject: [PATCH EDK2 v2 1/1] BaseTools/GenFfs: Optimazing else if statement
Date: Tue, 15 Dec 2020 14:30:46 +0800 [thread overview]
Message-ID: <1608013846-109318-2-git-send-email-xiewenyi2@huawei.com> (raw)
In-Reply-To: <1608013846-109318-1-git-send-email-xiewenyi2@huawei.com>
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
next prev parent reply other threads:[~2020-12-15 6:32 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 ` wenyi,xie [this message]
2020-12-21 2:07 ` [edk2-devel] [PATCH EDK2 v2 1/1] " Bob Feng
[not found] ` <1652993EE39DFAF7.21743@groups.io>
2020-12-21 2:27 ` Bob Feng
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=1608013846-109318-2-git-send-email-xiewenyi2@huawei.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