From 0944818a1972b07b09b53a2a1e88295cd92361cf Mon Sep 17 00:00:00 2001 From: "Carsey, Jaben" Date: Thu, 29 Mar 2018 08:02:17 +0800 Subject: BaseTools: no need to do int() API work for it int() with base=0 will already auto determine base from preceeding 0x/0X Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/Common/Expression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BaseTools/Source/Python/Common/Expression.py') diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index 9a844b0417..8e1a9866e1 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -845,7 +845,7 @@ class ValueExpressionEx(ValueExpression): if ItemSize == 0: try: - tmpValue = int(Item, 16) if Item.upper().startswith('0X') else int(Item, 0) + tmpValue = int(Item, 0) if tmpValue > 255: raise BadExpression("Byte array number %s should less than 0xFF." % Item) except BadExpression, Value: @@ -857,7 +857,7 @@ class ValueExpressionEx(ValueExpression): ItemValue = ParseFieldValue(Item)[0] if type(ItemValue) == type(''): - ItemValue = int(ItemValue, 16) if ItemValue.startswith('0x') else int(ItemValue) + ItemValue = int(ItemValue, 0) TmpValue = (ItemValue << (Size * 8)) | TmpValue Size = Size + ItemSize -- cgit v1.2.3