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>
This commit is contained in:
wenyi,xie via groups.io 2020-12-15 14:30:46 +08:00 committed by mergify[bot]
parent b6e360874f
commit d77f9b1eff
1 changed files with 5 additions and 6 deletions

View File

@ -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 {
sprintf (AlignmentBuffer, "%dK", Alignment/0x400);
}
else {
sprintf (AlignmentBuffer, "%dK", Alignment/0x400);
}
Status = StringtoAlignment (AlignmentBuffer, &(InputFileAlign[InputFileNum]));
}