From: "Bob Feng" <bob.c.feng@intel.com>
To: Wenyi Xie <xiewenyi2@huawei.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>,
"gaoliming@byosoft.com.cn" <gaoliming@byosoft.com.cn>,
"Chen, Christine" <yuwei.chen@intel.com>
Cc: "songdongkuang@huawei.com" <songdongkuang@huawei.com>
Subject: Re: [PATCH EDK2 v1 1/1] BaseTools/GenFfs: Optimazing else if statement
Date: Tue, 15 Dec 2020 04:02:07 +0000 [thread overview]
Message-ID: <DM6PR11MB4073E1B63091DE94CE3C997EC9C60@DM6PR11MB4073.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1607915489-70490-2-git-send-email-xiewenyi2@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
next prev parent reply other threads:[~2020-12-15 4:02 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 ` [PATCH EDK2 v1 1/1] " wenyi,xie
2020-12-15 4:02 ` Bob Feng [this message]
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=DM6PR11MB4073E1B63091DE94CE3C997EC9C60@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