summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarty E. Plummer <hanetzer@startmail.com>2019-05-10 03:12:09 -0500
committerRAJA DAS <rajadas2@in.ibm.com>2020-01-09 23:07:54 -0600
commit04a2b51f4c21e763ed9f0714b61360bdd69370a5 (patch)
treee93e832c5211b66007aa3846258e7870fee9cf8a
parent1ccc5efffc9ca96f24acb98887cdd4759d9e541f (diff)
downloadtalos-sbe-04a2b51f4c21e763ed9f0714b61360bdd69370a5.tar.gz
talos-sbe-04a2b51f4c21e763ed9f0714b61360bdd69370a5.zip
sbeCompression: use floor division
python2 returns an integer when both division operands are integers. python3 will return a float in this situation. Use the floor division operator (//) which returns an integer on both versions. Without this change, building with python3.x (python3.5 tested) as /usr/bin/python will result in the following error: Traceback (most recent call last): File "sbe/src/boot/sbeCompression.py", line 198, in <module> main( sys.argv ) File "sbe/src/boot/sbeCompression.py", line 181, in main compress(imagePath + "/" + image + ".base", imagePath + "/" + image + ".base.compressed") File "sbe/src/boot/sbeCompression.py", line 58, in compress for i in range(0, os.stat(inputFile).st_size / 4 ): TypeError: 'float' object cannot be interpreted as an integer Change-Id: Ibd63e9d2739eb6cf23d79d739237537e05932b15 Signed-off-by: Marty E. Plummer <hanetzer@startmail.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/89371 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Srikantha S. Meesala <srikantha@in.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
-rwxr-xr-xsrc/boot/sbeCompression.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/boot/sbeCompression.py b/src/boot/sbeCompression.py
index 82ec90ca..61ce0057 100755
--- a/src/boot/sbeCompression.py
+++ b/src/boot/sbeCompression.py
@@ -54,7 +54,7 @@ def compress(inputFile, compressedFile):
sys.exit(1)
instDict = dict()
- for i in range(0, os.stat(inputFile).st_size / 4 ):
+ for i in range(0, os.stat(inputFile).st_size // 4 ):
fourByt = f.read(4)
@@ -90,7 +90,7 @@ def compress(inputFile, compressedFile):
count = 0
#Create a bitmap for each four bytes of binary.
- for i in range(0, os.stat(inputFile).st_size / 4 ):
+ for i in range(0, os.stat(inputFile).st_size // 4 ):
fourByt = f.read(4)
if fourByt in instList:
@@ -99,7 +99,7 @@ def compress(inputFile, compressedFile):
else :
strBits += '0'
- if ((len(strBits) == 32) or (i == (os.stat(inputFile).st_size / 4) - 1)):
+ if ((len(strBits) == 32) or (i == (os.stat(inputFile).st_size // 4) - 1)):
value = int(strBits, 2)
fW.write(struct.pack('>I', value))
strBits = ""
@@ -117,7 +117,7 @@ def compress(inputFile, compressedFile):
f.seek(0, 0)
- for i in range(0, os.stat(inputFile).st_size / 4 ):
+ for i in range(0, os.stat(inputFile).st_size // 4 ):
fourByt = f.read(4)
OpenPOWER on IntegriCloud