Debian Codegraph @

mypyc/lib-rt/vecs_extra_ops.h

raw
1 #ifndef VECS_EXTRA_OPS_H
2 #define VECS_EXTRA_OPS_H
3
4 #include "vecs/librt_vecs_api.h"
5
6 // Check if obj is an instance of vec (any vec type)
7 static inline int CPyVec_Check(PyObject *obj) {
8 return PyObject_TypeCheck(obj, VecApi->get_vec_type());
9 }
10
11 static inline PyObject *CPyVecU8_ToBytes(VecU8 v) {
12 if (v.len == 0) {
13 return PyBytes_FromStringAndSize(NULL, 0);
14 }
15 return PyBytes_FromStringAndSize((const char *)v.items, v.len);
16 }
17
18 #endif