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
Boxiang Sun
cython
Commits
d42afbfb
Commit
d42afbfb
authored
Sep 22, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove all (incorrect) casts in abs(long long).
parent
55217d45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
Cython/Utility/Builtins.c
Cython/Utility/Builtins.c
+5
-5
No files found.
Cython/Utility/Builtins.c
View file @
d42afbfb
...
@@ -235,20 +235,20 @@ static PyObject* __Pyx_Intern(PyObject* s) {
...
@@ -235,20 +235,20 @@ static PyObject* __Pyx_Intern(PyObject* s) {
static
CYTHON_INLINE
PY_LONG_LONG
__Pyx_abs_longlong
(
PY_LONG_LONG
x
)
{
static
CYTHON_INLINE
PY_LONG_LONG
__Pyx_abs_longlong
(
PY_LONG_LONG
x
)
{
#if defined (__cplusplus) && __cplusplus >= 201103L
#if defined (__cplusplus) && __cplusplus >= 201103L
return
(
unsigned
PY_LONG_LONG
)
std
::
abs
(
x
);
return
std
::
abs
(
x
);
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
return
(
unsigned
PY_LONG_LONG
)
llabs
(
x
);
return
llabs
(
x
);
#elif defined (_MSC_VER)
#elif defined (_MSC_VER)
// abs() is defined for long, but 64-bits type on MSVC is long long.
// abs() is defined for long, but 64-bits type on MSVC is long long.
// Use MS-specific _abs64() instead, which returns the original (negative) value for abs(-MAX-1)
// Use MS-specific _abs64() instead, which returns the original (negative) value for abs(-MAX-1)
return
_abs64
(
x
);
return
_abs64
(
x
);
#elif defined (__GNUC__)
#elif defined (__GNUC__)
// gcc or clang on 64 bit windows.
// gcc or clang on 64 bit windows.
return
(
unsigned
PY_LONG_LONG
)
__builtin_llabs
(
x
);
return
__builtin_llabs
(
x
);
#else
#else
if
(
sizeof
(
PY_LONG_LONG
)
<=
sizeof
(
Py_ssize_t
))
if
(
sizeof
(
PY_LONG_LONG
)
<=
sizeof
(
Py_ssize_t
))
return
(
unsigned
PY_LONG_LONG
)
__Pyx_sst_abs
(
x
);
return
__Pyx_sst_abs
(
x
);
return
(
x
<
0
)
?
(
unsigned
PY_LONG_LONG
)
-
x
:
(
unsigned
PY_LONG_LONG
)
x
;
return
(
x
<
0
)
?
x
*
(
PY_LONG_LONG
)
-
1
:
x
;
#endif
#endif
}
}
...
...
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