Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: checking a set of numbers for consistency mod p

by hv (Prior)
on Apr 16, 2022 at 21:14 UTC ( [id://11143012]=note: print w/replies, xml ) Need Help??


in reply to Re^2: checking a set of numbers for consistency mod p
in thread checking a set of numbers for consistency mod p

Nice stuff. :) It's a shame it will silently go wrong when p > 8 * sizeof(int), though. If you're lucky, the compiler may support declaring a variable-sized int[] array to save the bother of mallocing, but just indexing into it will already make the code a chunk more complex.

And @LanX: there's no XS code here. The existence of Inline::C is the reason I never had to learn XS, and I'm very grateful for it. :)

Replies are listed 'Best First'.
Re^4: checking a set of numbers for consistency mod p
by LanX (Saint) on Apr 16, 2022 at 21:30 UTC
    > And @LanX: there's no XS code here.

    This doesn't look like vanilla C

    > > SV* item = *av_fetch( array, i, 0 );

    Probably differing definitions of "XS" ?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      SV* item = *av_fetch( array, i, 0 );

      I worry I'm simply being trolled, but: that looks absolutely like vanilla C to me. We're calling a function, passing it some arguments, getting back some sort of pointer-to-a-pointer, which we dereference and store in a new pointer variable. Clearly the function av_fetch() and the type SV will have been declared somewhere.

      The only magic here is an implicit #include <perl.h>, which brings in perl's standard typedefs, function declarations, etc. XS is a whole 'nother language that is parsed by its own compiler (xsubpp) rather than by a C compiler.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11143012]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-29 06:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found