Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
299ad116
Commit
299ad116
authored
Feb 13, 2017
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid too large shift on LLP64 systems.
This fixes #1562
parent
4924bd9c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Cython/Utility/Optimize.c
Cython/Utility/Optimize.c
+3
-3
No files found.
Cython/Utility/Optimize.c
View file @
299ad116
...
@@ -577,7 +577,7 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, CYTHO
...
@@ -577,7 +577,7 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, CYTHO
x
+=
((
x
!=
0
)
&
((
x
^
b
)
<
0
))
*
b
;
x
+=
((
x
!=
0
)
&
((
x
^
b
)
<
0
))
*
b
;
return
PyInt_FromLong
(
x
);
return
PyInt_FromLong
(
x
);
{{
elif
op
==
'
TrueDivide
'
}}
{{
elif
op
==
'
TrueDivide
'
}}
if
(
8
*
sizeof
(
long
)
<=
53
||
likely
(
labs
({{
ival
}})
<=
(
1L
<<
53
)))
{
if
(
8
*
sizeof
(
long
)
<=
53
||
likely
(
labs
({{
ival
}})
<=
(
(
PY_LONG_LONG
)
1
<<
53
)))
{
return
PyFloat_FromDouble
((
double
)
a
/
(
double
)
b
);
return
PyFloat_FromDouble
((
double
)
a
/
(
double
)
b
);
}
}
// let Python do the rounding
// let Python do the rounding
...
@@ -667,7 +667,7 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, CYTHO
...
@@ -667,7 +667,7 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, CYTHO
x
=
a
%
b
;
x
=
a
%
b
;
x
+=
((
x
!=
0
)
&
((
x
^
b
)
<
0
))
*
b
;
x
+=
((
x
!=
0
)
&
((
x
^
b
)
<
0
))
*
b
;
{{
elif
op
==
'
TrueDivide
'
}}
{{
elif
op
==
'
TrueDivide
'
}}
if
((
8
*
sizeof
(
long
)
<=
53
||
likely
(
labs
({{
ival
}})
<=
(
1L
<<
53
)))
if
((
8
*
sizeof
(
long
)
<=
53
||
likely
(
labs
({{
ival
}})
<=
(
(
PY_LONG_LONG
)
1
<<
53
)))
||
__Pyx_sst_abs
(
size
)
<=
52
/
PyLong_SHIFT
)
{
||
__Pyx_sst_abs
(
size
)
<=
52
/
PyLong_SHIFT
)
{
return
PyFloat_FromDouble
((
double
)
a
/
(
double
)
b
);
return
PyFloat_FromDouble
((
double
)
a
/
(
double
)
b
);
}
}
...
@@ -812,7 +812,7 @@ static PyObject* __Pyx_PyFloat_{{op}}{{order}}(PyObject *op1, PyObject *op2, dou
...
@@ -812,7 +812,7 @@ static PyObject* __Pyx_PyFloat_{{op}}{{order}}(PyObject *op1, PyObject *op2, dou
if
(
8
*
sizeof
(
unsigned
long
)
>
{{
_size
}}
*
PyLong_SHIFT
&&
((
8
*
sizeof
(
unsigned
long
)
<
53
)
||
({{
_size
-
1
}}
*
PyLong_SHIFT
<
53
)))
{
if
(
8
*
sizeof
(
unsigned
long
)
>
{{
_size
}}
*
PyLong_SHIFT
&&
((
8
*
sizeof
(
unsigned
long
)
<
53
)
||
({{
_size
-
1
}}
*
PyLong_SHIFT
<
53
)))
{
{{
fval
}}
=
(
double
)
{{
pylong_join
(
_size
,
'
digits
'
)}};
{{
fval
}}
=
(
double
)
{{
pylong_join
(
_size
,
'
digits
'
)}};
// let CPython do its own float rounding from 2**53 on (max. consecutive integer in double float)
// let CPython do its own float rounding from 2**53 on (max. consecutive integer in double float)
if
((
8
*
sizeof
(
unsigned
long
)
<
53
)
||
({{
_size
}}
*
PyLong_SHIFT
<
53
)
||
({{
fval
}}
<
(
double
)
(
1L
<<
53
)))
{
if
((
8
*
sizeof
(
unsigned
long
)
<
53
)
||
({{
_size
}}
*
PyLong_SHIFT
<
53
)
||
({{
fval
}}
<
(
double
)
(
(
PY_LONG_LONG
)
1
<<
53
)))
{
if
(
size
==
{{
-
_size
}})
if
(
size
==
{{
-
_size
}})
{{
fval
}}
=
-
{{
fval
}};
{{
fval
}}
=
-
{{
fval
}};
break
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment