# This file is used to parse and evaluate expression in directive or PCD value.\r
#\r
# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-#\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
## Import Modules\r
#\r
else:\r
Val = Val3\r
continue\r
+ #\r
+ # PEP 238 -- Changing the Division Operator\r
+ # x/y to return a reasonable approximation of the mathematical result of the division ("true division")\r
+ # x//y to return the floor ("floor division")\r
+ #\r
+ if Op == '/':\r
+ Op = '//'\r
try:\r
Val = self.Eval(Op, Val, EvalFunc())\r
except WrnExpression as Warn:\r
if TmpValue.bit_length() == 0:\r
PcdValue = '{0x00}'\r
else:\r
- for I in range((TmpValue.bit_length() + 7) / 8):\r
+ for I in range((TmpValue.bit_length() + 7) // 8):\r
TmpList.append('0x%02x' % ((TmpValue >> I * 8) & 0xff))\r
PcdValue = '{' + ', '.join(TmpList) + '}'\r
except:\r