SSE4a with ctypes in python? (gcc __builtin_popcount)

Heiko Wundram modelnine at modelnine.org
Mon Oct 31 04:41:17 EDT 2011


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.



More information about the Python-list mailing list