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 v1 1/1] BaseTools/GenFfs: Optimazing else if statement
Date: Mon, 14 Dec 2020 11:11:29 +0800 [thread overview]
Message-ID: <1607915489-70490-2-git-send-email-xiewenyi2@huawei.com> (raw)
In-Reply-To: <1607915489-70490-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 | 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
next prev parent reply other threads:[~2020-12-14 3:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2020-12-15 4:02 ` [PATCH EDK2 v1 1/1] " Bob Feng
2020-12-15 4:18 ` wenyi,xie
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=1607915489-70490-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