在我的64位計算機上,long long
類型有64位。如何在Cython中使用128位整數
print(sizeof(long long))
# prints 8
我需要使用128位整數,幸運的是GCC supports these。我如何在Cython中使用它們?
以下不起作用。編譯foo.pyx
只包含
cdef __int128_t x = 0
產生
$ cython foo.pyx
Error compiling Cython file:
------------------------------------------------------------
...
cdef __int128_t x = 0
^
------------------------------------------------------------
foo.pyx:2:5: '__int128_t' is not a type identifier
@BrettHale我不能只輸入'CDEF __int128_t x = 0的'。它不會編譯。 –
在這種情況下,'cdef'究竟是什麼? –
很明顯,這個問題是關於cython的,儘管它在標題中提到。 –