From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by mx.groups.io with SMTP id smtpd.web12.6049.1608005891471851663 for ; Mon, 14 Dec 2020 20:18:12 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: huawei.com, ip: 45.249.212.35, mailfrom: xiewenyi2@huawei.com) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Cw4jR4FPsz7GbQ; Tue, 15 Dec 2020 12:17:31 +0800 (CST) Received: from [10.174.154.225] (10.174.154.225) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Tue, 15 Dec 2020 12:18:00 +0800 Subject: Re: [PATCH EDK2 v1 1/1] BaseTools/GenFfs: Optimazing else if statement To: "Feng, Bob C" , "devel@edk2.groups.io" , "gaoliming@byosoft.com.cn" , "Chen, Christine" CC: "songdongkuang@huawei.com" References: <1607915489-70490-1-git-send-email-xiewenyi2@huawei.com> <1607915489-70490-2-git-send-email-xiewenyi2@huawei.com> From: "wenyi,xie" Message-ID: Date: Tue, 15 Dec 2020 12:18:00 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.0.1 MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.174.154.225] X-CFilter-Loop: Reflected Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit OK, I will remove the tab and send new patch soon. Thanks Wenyi On 2020/12/15 12:02, Feng, Bob C wrote: > 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 > Sent: Monday, December 14, 2020 11:11 AM > To: devel@edk2.groups.io; Feng, Bob C ; gaoliming@byosoft.com.cn; Chen, Christine > 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 > Cc: Liming Gao > Cc: Yuwei Chen > Signed-off-by: Wenyi Xie > --- > 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 > > . >