diff options
author | Carsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben> | 2018-03-29 08:02:17 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-03-30 09:16:01 +0800 |
commit | 0944818a1972b07b09b53a2a1e88295cd92361cf (patch) | |
tree | ab76f64fc90b43c8f5d69b57edeaab2ae1de6ca9 /BaseTools/Source/Python/Common | |
parent | 4231a8193ec0d52df7e0a101d96c51b1a2b7a996 (diff) | |
download | edk2-0944818a1972b07b09b53a2a1e88295cd92361cf.tar.gz edk2-0944818a1972b07b09b53a2a1e88295cd92361cf.tar.bz2 edk2-0944818a1972b07b09b53a2a1e88295cd92361cf.zip |
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 <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@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>
Diffstat (limited to 'BaseTools/Source/Python/Common')
-rw-r--r-- | BaseTools/Source/Python/Common/Expression.py | 4 |
1 files changed, 2 insertions, 2 deletions
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
|