BaseTools: expression can use single in instead of 3 API calls.

change 3 StartsWith() calls to a single 'in' operation.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Carsey, Jaben 2018-03-28 07:42:45 +08:00 committed by Yonghong Zhu
parent 56326323e6
commit 663b9e061e
1 changed files with 1 additions and 1 deletions

View File

@ -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]