Created
January 20, 2018 02:29
-
-
Save yuyu2172/8f9347728d377bb33a6ec3d5d57f2829 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpdef pass_by_ref(): | |
cdef int x | |
set_integer_ref(x) | |
return x | |
cpdef pass_by_ptr_0(): | |
cdef int[1] x | |
set_integer_ptr(x) | |
return x[0] | |
cpdef pass_by_ptr_1(): | |
cdef np.ndarray[int, ndim=1, mode='c'] x | |
x = np.zeros((1,), dtype=np.int32) | |
set_integer_ptr(&x[0]) | |
return x[0] | |
cpdef pass_by_ref_ptr(): | |
cdef int* x | |
set_integer_ref_ptr(x) | |
return x[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment