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
ee60f2a4
Commit
ee60f2a4
authored
Mar 20, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify non-/CPython special casing in utility function
parent
6e0e4e11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
Cython/Utility/Optimize.c
Cython/Utility/Optimize.c
+15
-7
No files found.
Cython/Utility/Optimize.c
View file @
ee60f2a4
...
...
@@ -481,15 +481,20 @@ fallback:
/////////////// PyIntBinop.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON
static
PyObject
*
__Pyx_PyInt_
{{
op
}}{{
order
}}(
PyObject
*
op1
,
PyObject
*
op2
,
long
intval
,
int
inplace
);
/*proto*/
#else
#define __Pyx_PyInt_{{op}}{{order}}(op1, op2, intval, inplace) \
((inplace ? PyNumber_InPlace{{op}} : PyNumber_{{op}})(op1, op2))
#endif
/////////////// PyIntBinop ///////////////
//@requires: TypeConversion.c::PyLongInternals
#if CYTHON_COMPILING_IN_CPYTHON
{{
py
:
pyval
,
ival
=
(
'
op2
'
,
'b'
)
if
order
==
'
CObj
'
else
(
'
op1
'
,
'a'
)
}}
static
PyObject
*
__Pyx_PyInt_
{{
op
}}{{
order
}}(
PyObject
*
op1
,
PyObject
*
op2
,
CYTHON_UNUSED
long
intval
,
int
inplace
)
{
#if CYTHON_COMPILING_IN_CPYTHON
const
long
{{
'a'
if
order
==
'
CObj
'
else
'b'
}}
=
intval
;
#if PY_MAJOR_VERSION < 3
...
...
@@ -522,21 +527,26 @@ static PyObject* __Pyx_PyInt_{{op}}{{order}}(PyObject *op1, PyObject *op2, CYTHO
double
{{
ival
}}
=
PyFloat_AS_DOUBLE
({{
pyval
}});
return
PyFloat_FromDouble
(((
double
)
a
)
{{
'+'
if
op
==
'
Add
'
else
'-'
}}
(
double
)
b
);
}
#endif
return
(
inplace
?
PyNumber_InPlace
{{
op
}}
:
PyNumber_
{{
op
}})(
op1
,
op2
);
}
#endif
/////////////// PyFloatBinop.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON
static
PyObject
*
__Pyx_PyFloat_
{{
op
}}{{
order
}}(
PyObject
*
op1
,
PyObject
*
op2
,
double
floatval
,
int
inplace
);
/*proto*/
#else
#define __Pyx_PyFloat_{{op}}{{order}}(op1, op2, floatval, inplace) \
((inplace ? PyNumber_InPlace{{op}} : PyNumber_{{op}})(op1, op2))
#endif
/////////////// PyFloatBinop ///////////////
//@requires: TypeConversion.c::PyLongInternals
#if CYTHON_COMPILING_IN_CPYTHON
{{
py
:
pyval
,
fval
=
(
'
op2
'
,
'b'
)
if
order
==
'
CObj
'
else
(
'
op1
'
,
'a'
)
}}
static
PyObject
*
__Pyx_PyFloat_
{{
op
}}{{
order
}}(
PyObject
*
op1
,
PyObject
*
op2
,
CYTHON_UNUSED
double
floatval
,
int
inplace
)
{
#if CYTHON_COMPILING_IN_CPYTHON
const
double
{{
'a'
if
order
==
'
CObj
'
else
'b'
}}
=
floatval
;
double
{{
fval
}};
...
...
@@ -558,9 +568,7 @@ static PyObject* __Pyx_PyFloat_{{op}}{{order}}(PyObject *op1, PyObject *op2, CYT
}
}
else
#endif
#endif
return
(
inplace
?
PyNumber_InPlace
{{
op
}}
:
PyNumber_
{{
op
}})(
op1
,
op2
);
#if CYTHON_COMPILING_IN_CPYTHON
return
PyFloat_FromDouble
(
a
{{
'+'
if
op
==
'
Add
'
else
'-'
}}
b
);
#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