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
0fdf2f78
Commit
0fdf2f78
authored
Mar 25, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More utility code specialization.
parent
e1881e05
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
Cython/Compiler/PyrexTypes.py
Cython/Compiler/PyrexTypes.py
+7
-3
Cython/Utils.py
Cython/Utils.py
+4
-1
No files found.
Cython/Compiler/PyrexTypes.py
View file @
0fdf2f78
...
...
@@ -14,6 +14,9 @@ class BaseType(object):
def
cast_code
(
self
,
expr_code
):
return
"((%s)%s)"
%
(
self
.
declaration_code
(
""
),
expr_code
)
def
specalization_name
(
self
):
return
self
.
declaration_code
(
""
).
replace
(
" "
,
"__"
)
def
base_declaration_code
(
self
,
base_code
,
entity_code
):
if
entity_code
:
return
"%s %s"
%
(
base_code
,
entity_code
)
...
...
@@ -601,8 +604,9 @@ class CFloatType(CNumericType):
to_py_function
=
"PyFloat_FromDouble"
from_py_function
=
"__pyx_PyFloat_AsDouble"
def
__init__
(
self
,
rank
,
pymemberdef_typecode
=
None
):
def
__init__
(
self
,
rank
,
pymemberdef_typecode
=
None
,
math_h_modifier
=
''
):
CNumericType
.
__init__
(
self
,
rank
,
1
,
pymemberdef_typecode
)
self
.
math_h_modifier
=
math_h_modifier
def
assignable_from_resolved_type
(
self
,
src_type
):
return
src_type
.
is_numeric
or
src_type
is
error_type
...
...
@@ -1193,9 +1197,9 @@ c_slonglong_type = CLongLongType(6, 2, "T_LONGLONG")
c_py_ssize_t_type
=
CPySSizeTType
(
4
,
2
,
"T_PYSSIZET"
)
c_size_t_type
=
CSizeTType
(
5
,
0
,
"T_SIZET"
)
c_float_type
=
CFloatType
(
7
,
"T_FLOAT"
)
c_float_type
=
CFloatType
(
7
,
"T_FLOAT"
,
math_h_modifier
=
'f'
)
c_double_type
=
CFloatType
(
8
,
"T_DOUBLE"
)
c_longdouble_type
=
CFloatType
(
9
)
c_longdouble_type
=
CFloatType
(
9
,
math_h_modifier
=
'l'
)
c_null_ptr_type
=
CNullPtrType
(
c_void_type
)
c_char_array_type
=
CCharArrayType
(
None
)
...
...
Cython/Utils.py
View file @
0fdf2f78
...
...
@@ -122,8 +122,11 @@ class UtilityCode(object):
else
:
writer
.
put
(
self
.
cleanup
)
def
specialize
(
self
,
**
data
):
def
specialize
(
self
,
pyrex_type
=
None
,
**
data
):
# Dicts aren't hashable...
if
pyrex_type
is
not
None
:
data
[
'type'
]
=
pyrex_type
.
declaration_code
(
''
)
data
[
'type_name'
]
=
pyrex_type
.
specalization_name
()
key
=
data
.
items
();
key
.
sort
();
key
=
tuple
(
key
)
try
:
return
self
.
_cache
[
key
]
...
...
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