-
-
Save HeXenCore/ed44c605cd66a95278bde0d1170c0476 to your computer and use it in GitHub Desktop.
Revisions
-
ricrogz renamed this gist
Oct 14, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ricrogz revised this gist
Oct 14, 2017 . No changes.There are no files selected for viewing
-
ricrogz renamed this gist
Oct 14, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
ricrogz created this gist
Oct 14, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ cdef extern from "header_int128.h": # Basically, we cheat cython to think we will use unsigned long long, # which is a 64 bit int ... ctypedef unsigned long long int128 print "hello world" cpdef int foo(): cdef int128 foo = 4 return 32 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ Taken from https://stackoverflow.com/questions/27582001/how-to-use-128-bit-integers-in-cython Basically, we make cython believe we will use 64 bit int to generate the .c file, but by using a C header we will, in fact, define a 128 bit int (the definition in the .h file does not match what we put into the pyx file). Once Cython has generated the .c file, we can compile it with GCC without further trouble, as GCC does support 128 bit ints This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ // ... but in the header, we give another definition, // the one for a 128 bit int. typedef __int128_t int128;