Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: Changeset: r92092:b235c624a167 Date: 2017-08-05 22:32 +0200 http://bitbucket.org/pypy/pypy/changeset/b235c624a167/
Log: remove bridge potential in hashing (int, int) tuples diff --git a/pypy/objspace/std/specialisedtupleobject.py b/pypy/objspace/std/specialisedtupleobject.py --- a/pypy/objspace/std/specialisedtupleobject.py +++ b/pypy/objspace/std/specialisedtupleobject.py @@ -74,8 +74,7 @@ elif typetuple[i] == int: # mimic cpythons behavior of a hash value of -2 for -1 y = value - if y == -1: - y = -2 + y -= (y == -1) # No explicit condition, to avoid JIT bridges elif typetuple[i] == float: # get the correct hash for float which is an # integer & other less frequent cases diff --git a/pypy/objspace/std/test/test_specialisedtupleobject.py b/pypy/objspace/std/test/test_specialisedtupleobject.py --- a/pypy/objspace/std/test/test_specialisedtupleobject.py +++ b/pypy/objspace/std/test/test_specialisedtupleobject.py @@ -37,6 +37,7 @@ self.space.eq(self.space.hash(N_w_tuple), self.space.hash(S_w_tuple))) + hash_test([-1, -1]) hash_test([1, 2]) hash_test([1.5, 2.8]) hash_test([1.0, 2.0]) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit