Am 31.10.2011 04:13, schrieb est:
Is it possible to rewrite the above gcc code in python using ctypes (preferably Win/*nix compatible)?
No; the (gcc-injected) functions starting with __builtin_* are not "real" functions in the sense that they can be called by calling into a library, but rather are converted to a series of assembler instructions by the compiler directly.
Wrapping this (distance) primitive by writing a C-module for Python, thus exposing the respective gcc-generated assembler code to Python through a module, won't yield any relevant speedups either, because most of the time will be spent in the call sequence for calling the function, and not in the actual computation.
-- --- Heiko. -- http://mail.python.org/mailman/listinfo/python-list