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
60dcbc7e
Commit
60dcbc7e
authored
Oct 12, 2013
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more cleanup in array.pxd
parent
0f27c211
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
Cython/Includes/cpython/array.pxd
Cython/Includes/cpython/array.pxd
+7
-9
No files found.
Cython/Includes/cpython/array.pxd
View file @
60dcbc7e
...
...
@@ -88,7 +88,7 @@ cdef extern from *: # Hard-coded utility code hack.
arraydescr
*
ob_descr
# struct arraydescr *ob_descr;
__data_union
data
def
__getbuffer__
(
array
self
,
Py_buffer
*
info
,
int
flags
):
def
__getbuffer__
(
self
,
Py_buffer
*
info
,
int
flags
):
# This implementation of getbuffer is geared towards Cython
# requirements, and does not yet fullfill the PEP.
# In particular strided access is always provided regardless
...
...
@@ -113,7 +113,7 @@ cdef extern from *: # Hard-coded utility code hack.
info
.
format
[
1
]
=
0
info
.
obj
=
self
def
__releasebuffer__
(
array
self
,
Py_buffer
*
info
):
def
__releasebuffer__
(
self
,
Py_buffer
*
info
):
PyMem_Free
(
info
.
shape
)
array
newarrayobject
(
PyTypeObject
*
type
,
Py_ssize_t
size
,
arraydescr
*
descr
)
...
...
@@ -129,7 +129,6 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero):
""" fast creation of a new array, given a template array.
type will be same as template.
if zero is true, new array will be initialized with zeroes."""
cdef
array
op
op
=
newarrayobject
(
Py_TYPE
(
template
),
length
,
template
.
ob_descr
)
if
zero
and
op
is
not
None
:
memset
(
op
.
data
.
as_chars
,
0
,
length
*
op
.
ob_descr
.
itemsize
)
...
...
@@ -137,7 +136,6 @@ cdef inline array clone(array template, Py_ssize_t length, bint zero):
cdef
inline
array
copy
(
array
self
):
""" make a copy of an array. """
cdef
array
op
op
=
newarrayobject
(
Py_TYPE
(
self
),
Py_SIZE
(
self
),
self
.
ob_descr
)
memcpy
(
op
.
data
.
as_chars
,
self
.
data
.
as_chars
,
Py_SIZE
(
op
)
*
op
.
ob_descr
.
itemsize
)
return
op
...
...
@@ -147,9 +145,9 @@ cdef inline int extend_buffer(array self, char* stuff, Py_ssize_t n) except -1:
(e.g. of same array type)
n: number of elements (not number of bytes!) """
cdef
Py_ssize_t
itemsize
=
self
.
ob_descr
.
itemsize
cdef
Py_ssize_t
orgsize
=
Py_SIZE
(
self
)
resize_smart
(
self
,
orgsize
+
n
)
memcpy
(
self
.
data
.
as_chars
+
orgsize
*
itemsize
,
stuff
,
n
*
itemsize
)
cdef
Py_ssize_t
or
i
gsize
=
Py_SIZE
(
self
)
resize_smart
(
self
,
or
i
gsize
+
n
)
memcpy
(
self
.
data
.
as_chars
+
or
i
gsize
*
itemsize
,
stuff
,
n
*
itemsize
)
return
0
cdef
inline
int
extend
(
array
self
,
array
other
)
except
-
1
:
...
...
@@ -158,6 +156,6 @@ cdef inline int extend(array self, array other) except -1:
PyErr_BadArgument
()
return
extend_buffer
(
self
,
other
.
data
.
as_chars
,
Py_SIZE
(
other
))
cdef
inline
void
zero
(
array
op
):
cdef
inline
void
zero
(
array
self
):
""" set all elements of array to zero. """
memset
(
op
.
data
.
as_chars
,
0
,
Py_SIZE
(
op
)
*
op
.
ob_descr
.
itemsize
)
memset
(
self
.
data
.
as_chars
,
0
,
Py_SIZE
(
self
)
*
self
.
ob_descr
.
itemsize
)
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