9

Cythonには次のインライン関数があります

cpdef inline int c_rate2recs_2(int maxNN,int idx):
  cdef int out=idx%maxNN
  return out

ただし、これは次のように変換されます

/* 
 *   return out
 * 
 * cpdef inline int c_rate2recs_2(int maxNN,int idx):             # <<<<<<<<<<<<<<
 *   cdef int out=idx%maxNN
 *   return out
 */

static PyObject *__pyx_pw_6kmc_cy_5c_rate2recs_2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static CYTHON_INLINE int __pyx_f_6kmc_cy_c_rate2recs_2(int __pyx_v_maxNN, int __pyx_v_idx, CYTHON_UNUSED int __pyx_skip_dispatch) {
  int __pyx_v_out;
  int __pyx_r;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("c_rate2recs_2", 0);
  __Pyx_TraceCall("c_rate2recs_2", __pyx_f[0], 984);

/* 
 *   return out
 * 
 * cpdef inline int c_rate2recs_2(int maxNN,int idx):             # <<<<<<<<<<<<<<
 *   cdef int out=idx%maxNN
 *   return out
 */

static PyObject *__pyx_pf_6kmc_cy_4c_rate2recs_2(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_maxNN, int __pyx_v_idx) {
  PyObject *__pyx_r = NULL;
  __Pyx_TraceDeclarations
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("c_rate2recs_2", 0);
  __Pyx_TraceCall("c_rate2recs_2", __pyx_f[0], 984);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_f_6kmc_cy_c_rate2recs_2(__pyx_v_maxNN, __pyx_v_idx, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 984; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("kmc_cy.c_rate2recs_2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_TraceReturn(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

私はcythonビジネスではかなり新しいので、ほとんどのPythonコマンドを取り除く方法を知りたいです(cython -aこのインラインは純粋なCからかなり離れているとフラグを立てます)。

4

1 に答える 1