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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
60f0e2f9
Commit
60f0e2f9
authored
Mar 29, 2015
by
Lisandro Dalcin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use PY_LONG_LONG instead of 'long long' in utility code
parent
ddf9821e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
17 deletions
+17
-17
Cython/Utility/Overflow.c
Cython/Utility/Overflow.c
+9
-9
Cython/Utility/TypeConversion.c
Cython/Utility/TypeConversion.c
+8
-8
No files found.
Cython/Utility/Overflow.c
View file @
60f0e2f9
...
...
@@ -83,8 +83,8 @@ static CYTHON_INLINE {{UINT}} __Pyx_mul_{{NAME}}_checking_overflow({{UINT}} a, {
{{
UINT
}}
r
=
({{
UINT
}})
big_r
;
*
overflow
|=
big_r
!=
r
;
return
r
;
}
else
if
(
sizeof
({{
UINT
}})
<
sizeof
(
unsigned
long
long
))
{
unsigned
long
long
big_r
=
((
unsigned
long
long
)
a
)
*
((
unsigned
long
long
)
b
);
}
else
if
(
sizeof
({{
UINT
}})
<
sizeof
(
unsigned
PY_LONG_LONG
))
{
unsigned
PY_LONG_LONG
big_r
=
((
unsigned
PY_LONG_LONG
)
a
)
*
((
unsigned
PY_LONG_LONG
)
b
);
{{
UINT
}}
r
=
({{
UINT
}})
big_r
;
*
overflow
|=
big_r
!=
r
;
return
r
;
...
...
@@ -137,8 +137,8 @@ static CYTHON_INLINE {{INT}} __Pyx_add_{{NAME}}_checking_overflow({{INT}} a, {{I
{{
INT
}}
r
=
({{
INT
}})
big_r
;
*
overflow
|=
big_r
!=
r
;
return
r
;
}
else
if
(
sizeof
({{
INT
}})
<
sizeof
(
long
long
))
{
long
long
big_r
=
((
long
long
)
a
)
+
((
long
long
)
b
);
}
else
if
(
sizeof
({{
INT
}})
<
sizeof
(
PY_LONG_LONG
))
{
PY_LONG_LONG
big_r
=
((
PY_LONG_LONG
)
a
)
+
((
PY_LONG_LONG
)
b
);
{{
INT
}}
r
=
({{
INT
}})
big_r
;
*
overflow
|=
big_r
!=
r
;
return
r
;
...
...
@@ -181,8 +181,8 @@ static CYTHON_INLINE {{INT}} __Pyx_mul_{{NAME}}_checking_overflow({{INT}} a, {{I
{{
INT
}}
r
=
({{
INT
}})
big_r
;
*
overflow
|=
big_r
!=
r
;
return
({{
INT
}})
r
;
}
else
if
(
sizeof
({{
INT
}})
<
sizeof
(
long
long
))
{
long
long
big_r
=
((
long
long
)
a
)
*
((
long
long
)
b
);
}
else
if
(
sizeof
({{
INT
}})
<
sizeof
(
PY_LONG_LONG
))
{
PY_LONG_LONG
big_r
=
((
PY_LONG_LONG
)
a
)
*
((
PY_LONG_LONG
)
b
);
{{
INT
}}
r
=
({{
INT
}})
big_r
;
*
overflow
|=
big_r
!=
r
;
return
({{
INT
}})
r
;
...
...
@@ -228,7 +228,7 @@ __Pyx_check_sane_{{NAME}}();
static
int
__Pyx_check_sane_
{{
NAME
}}(
void
)
{
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
int
)
||
sizeof
({{
TYPE
}})
==
sizeof
(
long
)
||
sizeof
({{
TYPE
}})
==
sizeof
(
long
long
))
{
sizeof
({{
TYPE
}})
==
sizeof
(
PY_LONG_LONG
))
{
return
0
;
}
else
{
PyErr_Format
(
PyExc_RuntimeError
,
\
...
...
@@ -252,7 +252,7 @@ static CYTHON_INLINE {{TYPE}} __Pyx_{{BINOP}}_{{NAME}}_checking_overflow({{TYPE}
return
__Pyx_
{{
BINOP
}}
_unsigned_int_checking_overflow
(
a
,
b
,
overflow
);
}
else
if
(
sizeof
({{
TYPE
}})
==
sizeof
(
unsigned
long
))
{
return
__Pyx_
{{
BINOP
}}
_unsigned_long_checking_overflow
(
a
,
b
,
overflow
);
}
else
if
(
sizeof
({{
TYPE
}})
==
sizeof
(
unsigned
long
long
))
{
}
else
if
(
sizeof
({{
TYPE
}})
==
sizeof
(
unsigned
PY_LONG_LONG
))
{
return
__Pyx_
{{
BINOP
}}
_unsigned_long_long_checking_overflow
(
a
,
b
,
overflow
);
}
else
{
abort
();
return
0
;
// handled elsewhere
...
...
@@ -262,7 +262,7 @@ static CYTHON_INLINE {{TYPE}} __Pyx_{{BINOP}}_{{NAME}}_checking_overflow({{TYPE}
return
__Pyx_
{{
BINOP
}}
_int_checking_overflow
(
a
,
b
,
overflow
);
}
else
if
(
sizeof
({{
TYPE
}})
==
sizeof
(
long
))
{
return
__Pyx_
{{
BINOP
}}
_long_checking_overflow
(
a
,
b
,
overflow
);
}
else
if
(
sizeof
({{
TYPE
}})
==
sizeof
(
long
long
))
{
}
else
if
(
sizeof
({{
TYPE
}})
==
sizeof
(
PY_LONG_LONG
))
{
return
__Pyx_
{{
BINOP
}}
_long_long_checking_overflow
(
a
,
b
,
overflow
);
}
else
{
abort
();
return
0
;
// handled elsewhere
...
...
Cython/Utility/TypeConversion.c
View file @
60f0e2f9
...
...
@@ -475,14 +475,14 @@ static CYTHON_INLINE PyObject* {{TO_PY_FUNCTION}}({{TYPE}} value) {
return
PyInt_FromLong
((
long
)
value
);
}
else
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
unsigned
long
))
{
return
PyLong_FromUnsignedLong
((
unsigned
long
)
value
);
}
else
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
unsigned
long
long
))
{
return
PyLong_FromUnsignedLongLong
((
unsigned
long
long
)
value
);
}
else
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
unsigned
PY_LONG_LONG
))
{
return
PyLong_FromUnsignedLongLong
((
unsigned
PY_LONG_LONG
)
value
);
}
}
else
{
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
long
))
{
return
PyInt_FromLong
((
long
)
value
);
}
else
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
long
long
))
{
return
PyLong_FromLongLong
((
long
long
)
value
);
}
else
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
PY_LONG_LONG
))
{
return
PyLong_FromLongLong
((
PY_LONG_LONG
)
value
);
}
}
{
...
...
@@ -563,8 +563,8 @@ static CYTHON_INLINE {{TYPE}} {{FROM_PY_FUNCTION}}(PyObject *x) {
#endif
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
unsigned
long
))
{
__PYX_VERIFY_RETURN_INT
({{
TYPE
}},
unsigned
long
,
PyLong_AsUnsignedLong
(
x
))
}
else
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
unsigned
long
long
))
{
__PYX_VERIFY_RETURN_INT
({{
TYPE
}},
unsigned
long
long
,
PyLong_AsUnsignedLongLong
(
x
))
}
else
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
unsigned
PY_LONG_LONG
))
{
__PYX_VERIFY_RETURN_INT
({{
TYPE
}},
unsigned
PY_LONG_LONG
,
PyLong_AsUnsignedLongLong
(
x
))
}
}
else
{
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
...
...
@@ -578,8 +578,8 @@ static CYTHON_INLINE {{TYPE}} {{FROM_PY_FUNCTION}}(PyObject *x) {
#endif
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
long
))
{
__PYX_VERIFY_RETURN_INT
({{
TYPE
}},
long
,
PyLong_AsLong
(
x
))
}
else
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
long
long
))
{
__PYX_VERIFY_RETURN_INT
({{
TYPE
}},
long
long
,
PyLong_AsLongLong
(
x
))
}
else
if
(
sizeof
({{
TYPE
}})
<=
sizeof
(
PY_LONG_LONG
))
{
__PYX_VERIFY_RETURN_INT
({{
TYPE
}},
PY_LONG_LONG
,
PyLong_AsLongLong
(
x
))
}
}
{
...
...
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