From 4a2e85acfbf5ddd5ffc266d867d23cf472d517e6 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Tue, 7 Feb 2017 14:12:45 +0000 Subject: sancov.py: [Py3] Use '//' instead of '/' as division operator. Py3 emits float with '/'. This is part of https://reviews.llvm.org/D27405 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294306 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/sanitizer_common/scripts/sancov.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/sanitizer_common/scripts') diff --git a/lib/sanitizer_common/scripts/sancov.py b/lib/sanitizer_common/scripts/sancov.py index e19afdb71..1c54e090c 100755 --- a/lib/sanitizer_common/scripts/sancov.py +++ b/lib/sanitizer_common/scripts/sancov.py @@ -68,8 +68,10 @@ def ReadOneFile(path): raise Exception('File %s is short (< 8 bytes)' % path) bits = ReadMagicAndReturnBitness(f, path) size -= 8 - s = struct.unpack_from(TypeCodeForStruct(bits) * (size * 8 / bits), f.read(size)) - print >>sys.stderr, "%s: read %d %d-bit PCs from %s" % (prog_name, size * 8 / bits, bits, path) + w = size * 8 // bits + s = struct.unpack_from(TypeCodeForStruct(bits) * (w), f.read(size)) + sys.stderr.write( + "%s: read %d %d-bit PCs from %s\n" % (prog_name, w, bits, path)) return s def Merge(files): @@ -152,7 +154,7 @@ def UnpackOneRawFile(path, map_path): f.seek(0, 2) size = f.tell() f.seek(0, 0) - pcs = struct.unpack_from(TypeCodeForStruct(bits) * (size * 8 / bits), f.read(size)) + pcs = struct.unpack_from(TypeCodeForStruct(bits) * (size * 8 // bits), f.read(size)) mem_map_pcs = [[] for i in range(0, len(mem_map))] for pc in pcs: -- cgit v1.2.3