BaseTools: expression can use single in instead of 3 API calls.
[mirror_edk2.git] / BaseTools / Source / Python / Common / Expression.py
index 683604cab5d3a9a83089522e2f9d23d0d4156a9f..30711cedd784f83922430c39b95a7343f09a0473 100644 (file)
@@ -991,7 +991,7 @@ class ValueExpressionEx(ValueExpression):
                                 Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue\r
                                 if ItemSize == 0:\r
                                     ItemValue, ItemSize = ParseFieldValue(Item)\r
                                 Item = '0x%x' % TmpValue if type(TmpValue) != type('') else TmpValue\r
                                 if ItemSize == 0:\r
                                     ItemValue, ItemSize = ParseFieldValue(Item)\r
-                                    if not (Item.startswith('"') or Item.startswith('L') or Item.startswith('{')) and ItemSize > 1:\r
+                                    if Item[0] not in ['"','L','{'] and ItemSize > 1:\r
                                         raise BadExpression("Byte  array number %s should less than 0xFF." % Item)\r
                                 else:\r
                                     ItemValue = ParseFieldValue(Item)[0]\r
                                         raise BadExpression("Byte  array number %s should less than 0xFF." % Item)\r
                                 else:\r
                                     ItemValue = ParseFieldValue(Item)[0]\r