Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
No such thing as a small change
 
PerlMonks  

Re: XS: returning a 64-bit unsigned int?

by ikegami (Pope)
on Sep 27, 2011 at 07:13 UTC ( #928029=note: print w/ replies, xml ) Need Help??


in reply to XS: returning a 64-bit unsigned int?

Which one of these is not like the other...

#define SvNOK_only(sv) \ (SvOK_off(sv), SvFLAGS(sv) |= (SVf_NOK|SVp_NOK)) #define SvIOK_only(sv) \ (SvOK_off(sv), SvFLAGS(sv) |= (SVf_IOK|SVp_IOK)) #define SvIOK_only_UV(sv) \ (assert_not_glob(sv) \ SvOK_off_exc_UV(sv), SvFLAGS(sv) |= (SVf_IOK|SVp_IOK))


Comment on Re: XS: returning a 64-bit unsigned int?
Download Code
Re^2: XS: returning a 64-bit unsigned int?
by BrowserUk (Pope) on Sep 27, 2011 at 07:23 UTC

    I can see the difference, but what it means I have no idea?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      The UV version turns on IOK and *preserves* IsUV instead of turning on IOK and IsUV.

      The other two don't preserve anything.

      I don't know why the difference.

      There is a SvIsUV_on(sv) that would have done the trick. Keep in mind that your original approach didn't converting the scalar to one that supports IVs (if possible) and you didn't handle magic. If it's just an internal scalar, you could get away with not doing those, though.

        There is a SvIsUV_on(sv)

        Not in the docs I'm looking at. Where did you dig that one up from?

        and you didn't handle magic. If it's just an internal scalar, you could get away with not doing those,

        No, I never handle magic. It's not laziness but a design choice. The reason I drop into XS/I::C is for performance. There is no point in doing that if you then allow people to pass you arrays that are tied to disk, or scalars that use post-its as backing store :)

        IMO the way perl handles magic in-line, is all wrong anyway. It imposes huge costs for something that is actually quite a rare event. It ought to be possible to make a single determination at the top of a routine and defer to a separate routine that handles magic when needed, thus leaving the main-line code free of such considerations. But that's another wish list item that it's far too late to consider at this point.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-04-25 01:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (579 votes), past polls