aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/python
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2016-09-20 10:57:02 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2016-09-20 10:57:02 +0100
commit564beb5f9b4cd40b4d60a524dd41950faec9a40d (patch)
tree19015c0ead85ff8066c51862e53d6d7692c944d0 /libstdc++-v3/python
parenta063e2049849b38816068bd279a9f2fb542120f9 (diff)
downloadgcc-564beb5f9b4cd40b4d60a524dd41950faec9a40d.zip
gcc-564beb5f9b4cd40b4d60a524dd41950faec9a40d.tar.gz
gcc-564beb5f9b4cd40b4d60a524dd41950faec9a40d.tar.bz2
Replace casts with floordiv operator in Python xmethods
* python/libstdcxx/v6/xmethods.py (DequeWorkerBase.__init__) (DequeWorkerBase.index, VectorWorkerBase.get): Use // for division. From-SVN: r240258
Diffstat (limited to 'libstdc++-v3/python')
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/xmethods.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
index 71a5b75..eb0dd79 100644
--- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py
+++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
@@ -165,7 +165,7 @@ class ArrayMethodsMatcher(gdb.xmethod.XMethodMatcher):
class DequeWorkerBase(gdb.xmethod.XMethodWorker):
def __init__(self, val_type):
self._val_type = val_type
- self._bufsize = int(512 / val_type.sizeof) or 1
+ self._bufsize = 512 // val_type.sizeof or 1
def size(self, obj):
first_node = obj['_M_impl']['_M_start']['_M_node']
@@ -176,7 +176,7 @@ class DequeWorkerBase(gdb.xmethod.XMethodWorker):
def index(self, obj, idx):
first_node = obj['_M_impl']['_M_start']['_M_node']
- index_node = first_node + int(idx / self._bufsize)
+ index_node = first_node + int(idx) // self._bufsize
return index_node[0][idx % self._bufsize]
class DequeEmptyWorker(DequeWorkerBase):
@@ -419,7 +419,7 @@ class VectorWorkerBase(gdb.xmethod.XMethodWorker):
if self._val_type.code == gdb.TYPE_CODE_BOOL:
start = obj['_M_impl']['_M_start']['_M_p']
bit_size = start.dereference().type.sizeof * 8
- valp = start + int(index / bit_size)
+ valp = start + index // bit_size
offset = index % bit_size
return (valp.dereference() & (1 << offset)) > 0
else: