note
danaj
<p>It's more complicated than you need, but there is some inline assembly in <a href="https://metacpan.org/pod/Math::Prime::Util">Math::Prime::Util</a>. See mulmod.h and montmath.h. Basically just C code with preprocessor wrappers for different platforms.</p>
<p>You can use Devel::CheckLib or similar packages for build time configuration as well.</p>
<p>For testing, I recommend Linux / Unix x86 machines that match your target, an x86 that doesn't (e.g. x86 non-64), a Mac especially since they use clang which acts slightly differently than gcc (different preprocessor defines), Windows. If you're ambitious, Cygwin and a non-x86 machine.</p>
1186207
1186207