cdef extern from "emmintrin.h": # I'm going off the microsoft documentation for where the headers are
# define the datatype as an opaque type
ctypedef struct __m128i x:
pass
__m128i _mm_set_epi32 (int i3, int i2, int i1, int i0)
cdef extern from "wmmintrin.h":
__m128i _mm_aesdec_si128(__m128i v,__m128i rkey)
# then in some Cython function
def f():
cdef __m128i v = _mm_set_epi32(1,2,3,4)
cdef __m128i key = _mm_set_epi32(5,6,7,8)
cdef __m128i result = _mm_aesdec_si128(v,key)
您应该能够将内部函数定义为Cython中的普通C函数。有点像
问题“如何在
^{pr2}$bytes
数组上应用它”?首先,得到字节数组的char*
。然后用range
对其进行迭代(注意不要跑完末尾)。在相关问题 更多 >
编程相关推荐