Inline::C uses its own Inline_Stack_(Vars|Reset|Done) macros in place of XS's dSP|EXTEND macros. Inline_Stack_Push is used instead of mPUSHi, although you can still use the mXPUSHi form to simplify. See "#The_Inline_Stack_Macros" in Inline::C.
The Inline docs say that you should be able to use the old macros, but I cannot see how to make that work.
Having made the changes mentioned above, this code now works for me:
Caveat: All my XS knowledge predates Inline::C, so any of the above could be flawed in minor ways.#! perl -slw use strict; use Inline C => Config => BUILD_NOISY => 1; use Inline C => <<'END_C', NAME => 'rand64fast', CLEAN_AFTER_BUILD => + 0; void rnd( int n ) { // dSP; // static __int64 y = 2463534242; static int y = 2463534242; // My machine is 32-bit. // EXTEND( SP, n ); Inline_Stack_Vars; Inline_Stack_Reset; while( --n ) { y ^= y << 13; y ^= y >> 17; y ^= y << 5; // mPUSHi( (IV)y ); Inline_Stack_Push( sv_2mortal( newSViv(y) ) ); // mXPUSHi(y); // Could have used this instead. Note the added + X } // return; Inline_Stack_Done; } END_C print for rnd( 100 );
In reply to Re: XS: EXTEND/mPUSHi
by Util
in thread XS: EXTEND/mPUSHi
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |