summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorwenyi,xie via groups.io <xiewenyi2=huawei.com@groups.io>2020-12-15 14:30:46 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-12-22 03:31:36 +0000
commitd77f9b1efff816522d10b34a68114f6ec34488dd (patch)
tree97d1cce5e4aabc2b10ec6d2ae3f6401fe1bd98a7 /BaseTools
parentb6e360874f4da1eb2ad82dac00938d1286741884 (diff)
downloadedk2-d77f9b1efff816522d10b34a68114f6ec34488dd.tar.gz
edk2-d77f9b1efff816522d10b34a68114f6ec34488dd.tar.bz2
edk2-d77f9b1efff816522d10b34a68114f6ec34488dd.zip
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> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/C/GenFfs/GenFfs.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index fcb911f4fc..949025c333 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]));
}