mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Cray J90 fixes for long ints.
This was a convenient excuse to create the pyport.h file recently discussed! Please use new Py_ARITHMETIC_RIGHT_SHIFT when right-shifting a signed int and you *need* sign-extension. This is #define'd in pyport.h, keying off new config symbol SIGNED_RIGHT_SHIFT_ZERO_FILLS. If you're running on a platform that needs that symbol #define'd, the std tests never would have worked for you (in particular, at least test_long would have failed). The autoconfig stuff got added to Python after my Unix days, so I don't know how that works. Would someone please look into doing & testing an auto-config of the SIGNED_RIGHT_SHIFT_ZERO_FILLS symbol? It needs to be defined if & only if, e.g., (-1) >> 3 is not -1.
This commit is contained in:
parent
5639ba4896
commit
7d3a511a40
6 changed files with 76 additions and 12 deletions
|
@ -721,10 +721,7 @@ int_rshift(v, w)
|
|||
a = 0;
|
||||
}
|
||||
else {
|
||||
if (a < 0)
|
||||
a = ~( ~(unsigned long)a >> b );
|
||||
else
|
||||
a = (unsigned long)a >> b;
|
||||
a = Py_ARITHMETIC_RIGHT_SHIFT(long, a, b);
|
||||
}
|
||||
return PyInt_FromLong(a);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue