* [PATCH EDK2 v2 0/1] BaseTools/GenFfs: Optimazing else if statement @ 2020-12-15 6:30 wenyi,xie 2020-12-15 6:30 ` [PATCH EDK2 v2 1/1] " wenyi,xie 0 siblings, 1 reply; 4+ messages in thread From: wenyi,xie @ 2020-12-15 6:30 UTC (permalink / raw) To: devel, bob.c.feng, gaoliming, yuwei.chen; +Cc: songdongkuang, xiewenyi2 Main Changes since v1 : Replace tab with space. Wenyi Xie (1): BaseTools/GenFfs: Optimazing else if statement BaseTools/Source/C/GenFfs/GenFfs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -- 2.20.1.windows.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH EDK2 v2 1/1] BaseTools/GenFfs: Optimazing else if statement 2020-12-15 6:30 [PATCH EDK2 v2 0/1] BaseTools/GenFfs: Optimazing else if statement wenyi,xie @ 2020-12-15 6:30 ` wenyi,xie 2020-12-21 2:07 ` [edk2-devel] " Bob Feng [not found] ` <1652993EE39DFAF7.21743@groups.io> 0 siblings, 2 replies; 4+ messages in thread From: wenyi,xie @ 2020-12-15 6:30 UTC (permalink / raw) To: devel, bob.c.feng, gaoliming, yuwei.chen; +Cc: songdongkuang, xiewenyi2 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c index fcb911f4fc34..949025c33325 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])); } -- 2.20.1.windows.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [PATCH EDK2 v2 1/1] BaseTools/GenFfs: Optimazing else if statement 2020-12-15 6:30 ` [PATCH EDK2 v2 1/1] " wenyi,xie @ 2020-12-21 2:07 ` Bob Feng [not found] ` <1652993EE39DFAF7.21743@groups.io> 1 sibling, 0 replies; 4+ messages in thread From: Bob Feng @ 2020-12-21 2:07 UTC (permalink / raw) To: devel@edk2.groups.io, xiewenyi2@huawei.com, gaoliming@byosoft.com.cn, Chen, Christine Cc: songdongkuang@huawei.com Reviewed-by: Bob Feng <bob.c.feng@intel.com> -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of wenyi,xie via groups.io Sent: Tuesday, December 15, 2020 2:31 PM 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: [edk2-devel] [PATCH EDK2 v2 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c index fcb911f4fc34..949025c33325 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])); } -- 2.20.1.windows.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <1652993EE39DFAF7.21743@groups.io>]
* Re: [edk2-devel] [PATCH EDK2 v2 1/1] BaseTools/GenFfs: Optimazing else if statement [not found] ` <1652993EE39DFAF7.21743@groups.io> @ 2020-12-21 2:27 ` Bob Feng 0 siblings, 0 replies; 4+ messages in thread From: Bob Feng @ 2020-12-21 2:27 UTC (permalink / raw) To: devel@edk2.groups.io, Feng, Bob C, xiewenyi2@huawei.com, gaoliming@byosoft.com.cn, Chen, Christine Cc: songdongkuang@huawei.com Created a PR https://github.com/tianocore/edk2/pull/1250 -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob Feng Sent: Monday, December 21, 2020 10:07 AM To: devel@edk2.groups.io; xiewenyi2@huawei.com; gaoliming@byosoft.com.cn; Chen, Christine <yuwei.chen@intel.com> Cc: songdongkuang@huawei.com Subject: Re: [edk2-devel] [PATCH EDK2 v2 1/1] BaseTools/GenFfs: Optimazing else if statement Reviewed-by: Bob Feng <bob.c.feng@intel.com> -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of wenyi,xie via groups.io Sent: Tuesday, December 15, 2020 2:31 PM 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: [edk2-devel] [PATCH EDK2 v2 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 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c index fcb911f4fc34..949025c33325 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])); } -- 2.20.1.windows.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-12-21 2:27 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-12-15 6:30 [PATCH EDK2 v2 0/1] BaseTools/GenFfs: Optimazing else if statement wenyi,xie 2020-12-15 6:30 ` [PATCH EDK2 v2 1/1] " wenyi,xie 2020-12-21 2:07 ` [edk2-devel] " Bob Feng [not found] ` <1652993EE39DFAF7.21743@groups.io> 2020-12-21 2:27 ` Bob Feng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox