File: asmemory.pxi

package info (click to toggle)
paraview 3.14.1-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 234,468 kB
  • sloc: cpp: 2,166,013; ansic: 801,575; xml: 58,068; tcl: 49,247; python: 43,091; java: 16,625; fortran: 12,224; sh: 11,722; yacc: 5,688; perl: 3,128; makefile: 2,228; lex: 1,311; lisp: 486; asm: 471; pascal: 228
file content (14 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#---------------------------------------------------------------------

cdef inline object asmemory(object ob, void** base, MPI_Aint* size):
    cdef void *p = NULL
    cdef Py_ssize_t n = 0
    PyObject_AsWriteBuffer(ob, &p, &n)
    if base: base[0] = p
    if size: size[0] = n
    return ob

cdef inline object tomemory(void *base, MPI_Aint size):
    return PyBuffer_FromReadWriteMemory(base, <Py_ssize_t>size)

#---------------------------------------------------------------------