From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.5987.1608004932887079760 for ; Mon, 14 Dec 2020 20:02:12 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=kYRLBi7g; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: bob.c.feng@intel.com) IronPort-SDR: nM3T1ru2hCbGziPFN2NjEJuRZQLH04G1nGAIjJNP0A6uo4rUNu3N+JvgD/uGB7LVIs13m7t1sd wF9eAws2OycQ== X-IronPort-AV: E=McAfee;i="6000,8403,9835"; a="259549045" X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="259549045" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2020 20:02:11 -0800 IronPort-SDR: g17oeBczxlnX+hKGrdvT5Udj78R1tTFVSs6QliyoU4i4GKvLFlZsb9nHim4TFsECJQcWCQmXbx w7/EFkD50IVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,420,1599548400"; d="scan'208";a="332052884" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga007.fm.intel.com with ESMTP; 14 Dec 2020 20:02:10 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 14 Dec 2020 20:02:09 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Mon, 14 Dec 2020 20:02:09 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.171) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Mon, 14 Dec 2020 20:02:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GwDWKI4BMMaZL7xSEN5iWs0o3Xn0rfHi+0kskP6gEoVqMxVg4qqMnoWAEwydhb9ZcIcxF7ny4M4xaVhOUjBTLzHgA3512ODKX393++Xah0lZzUJIGGHUaZ03P5tX7GQ77Epj3/Zq2v4hOLAvsf/860JzOtf/yDpk48BsdHYmfah1SaNYm22wpvlFbgrRCdtej6H5XIENWFe1KiaAG29oclq7+URp5lH5N26Z8U3gohxRiRtx+3oKU/Elb3mnCYBzbyHRau1//6wtYEFAqvb3tGguDICfsi8QTb6ljyZa3hipXxTzPSTH4x8p8WLwA/yTgqrFxKf1CjRSZzUZrckTpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yzND16Oxmt820R0cQPSCDvpokLj8w1MZ/Cw4J8rrr40=; b=PDzqNnpT1gJIoJ9vpb2STcIw/Ou+KYAykvVaCeVewUqwD6tjs7sKdzZs75PE3SmF2VMN+5DHcrJ+6WxNwCA2UETAhrqvMc49IHkmo4a18kEd0F3a2O6GtRUTe4k6/maLKlDm4mL9SudEDuyIBZb96kOdqEF8oOSaHw8OY7q/fCyZiOsU++1XM0QE6S5Ts9gSg7WTij6Eh2KnbVE2ngi6FJkoc+JyD7ZMq0czOz3bfRoB0rAIIcAub7JvsImWVdRV17hUH/AyBjNuXGfHCyvzuwp9DyJNLoW+GbTUBrKm/p202ywZAIfuVTmWy/Hswehb9sBso1unLRzQZ7hdEJs7BA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yzND16Oxmt820R0cQPSCDvpokLj8w1MZ/Cw4J8rrr40=; b=kYRLBi7g+DE3XJ1V2qXAhnVVk9DRUlhhX27pw0ZgtzVcJ81uRIZLxYDbStnV2NLAf1aupoFCk38f4Q3FYVoVxbhrH3LoE1CHh82CwSsz3tc3nIsrHbbXoAIqc/tKO4CS2w+qzxedAEL6RfG3+8XTmprOdxiMTFWSX0mBqEQ6MuI= Received: from DM6PR11MB4073.namprd11.prod.outlook.com (2603:10b6:5:19f::22) by DM5PR11MB1305.namprd11.prod.outlook.com (2603:10b6:3:13::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.24; Tue, 15 Dec 2020 04:02:07 +0000 Received: from DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::c9f:47ea:6321:5ccb]) by DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::c9f:47ea:6321:5ccb%3]) with mapi id 15.20.3654.025; Tue, 15 Dec 2020 04:02:07 +0000 From: "Bob Feng" To: Wenyi Xie , "devel@edk2.groups.io" , "gaoliming@byosoft.com.cn" , "Chen, Christine" CC: "songdongkuang@huawei.com" Subject: Re: [PATCH EDK2 v1 1/1] BaseTools/GenFfs: Optimazing else if statement Thread-Topic: [PATCH EDK2 v1 1/1] BaseTools/GenFfs: Optimazing else if statement Thread-Index: AQHW0ccf8ged1r7I20e9GJ2IK19Tdqn3iVYw Date: Tue, 15 Dec 2020 04:02:07 +0000 Message-ID: References: <1607915489-70490-1-git-send-email-xiewenyi2@huawei.com> <1607915489-70490-2-git-send-email-xiewenyi2@huawei.com> In-Reply-To: <1607915489-70490-2-git-send-email-xiewenyi2@huawei.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c0e28385-caa6-4876-6350-08d8a0ae3099 x-ms-traffictypediagnostic: DM5PR11MB1305: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1303; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: mG2sdtlvW1tCc9kkUm6gTQqfE4OBQKLUeTRutPmRlB1P0qHCD9trpEP+h/rZ4w6gU+a6+ses9GziIKnz+zd+Jcpl8Hoju1mYTwto52PkbnnvALKMegoaHYsBurD0Gksw1NLCF1GXjuClSNeykP7IBVD4e7ILW5Yd4i+YsDH4Ey6Jn87QdBupR2ZfxhqBmHR2vQGAz0uy/C2fo9Fd3453xsnYlRE0S6hs3rrVm5tUgpBnO5NdyAiw/mEy5HAqw8+B2TUaWezQB/vabsAZeWRDTQZRLqT9DhFlT58XtZs6wnUhhsr+pDnUly6GotZvVsFN1aHgax2+Q4iSJVsbwO/c0Q== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4073.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(376002)(366004)(136003)(9686003)(71200400001)(55016002)(83380400001)(26005)(33656002)(52536014)(5660300002)(6636002)(2906002)(64756008)(66476007)(8676002)(8936002)(66556008)(86362001)(76116006)(6506007)(53546011)(186003)(110136005)(7696005)(508600001)(4326008)(66446008)(66946007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?BC8qVMtbSgrBARlayB9PS63rwuN7JUEu5Ql1AR7Lv34DGVm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EIA2kjsUmJ+/M77ud9YgCIGwPoULtbiRrUPFdx?= =?us-ascii?Q?uPsEAMbxyKTp+4uPlZ17h16V0BeII0xX/Nzg/JSb6OU=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4073.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0e28385-caa6-4876-6350-08d8a0ae3099 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2020 04:02:07.2457 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HTJfZ2blFFhi7iGzEkUm+bAF7CTEpqiXzzmuxV5m9aYpA4if3uECpOa45xS7wQxt80AMy+RSy6Ot+5KKqB+k/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1305 Return-Path: bob.c.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 scrip= t before sending the patch review. Thanks, Bob -----Original Message----- From: Wenyi Xie =20 Sent: Monday, December 14, 2020 11:11 AM To: devel@edk2.groups.io; Feng, Bob C ; gaoliming@byo= soft.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 >=3D 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 >=3D 0x400) { - if (Alignment >=3D 0x100000) { + else if (Alignment >=3D 0x100000) { sprintf (AlignmentBuffer, "%dM", Alignment/0x100000); - } else { + } + else { sprintf (AlignmentBuffer, "%dK", Alignment/0x400); - } } Status =3D StringtoAlignment (AlignmentBuffer, &(InputFileAlign[= InputFileNum])); } -- 2.20.1.windows.1