From: Carsey, Jaben Date: Tue, 27 Mar 2018 23:42:45 +0000 (+0800) Subject: BaseTools: expression can use single in instead of 3 API calls. X-Git-Tag: edk2-stable201903~2018 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=663b9e061ed1b48e562159e51333e996f1efc830;ds=sidebyside BaseTools: expression can use single in instead of 3 API calls. change 3 StartsWith() calls to a single 'in' operation. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index 683604cab5..30711cedd7 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -991,7 +991,7 @@ class ValueExpressionEx(ValueExpression): Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue if ItemSize == 0: ItemValue, ItemSize = ParseFieldValue(Item) - if not (Item.startswith('"') or Item.startswith('L') or Item.startswith('{')) and ItemSize > 1: + if Item[0] not in ['"','L','{'] and ItemSize > 1: raise BadExpression("Byte array number %s should less than 0xFF." % Item) else: ItemValue = ParseFieldValue(Item)[0]