Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by syphilis (Canon)
on Sep 27, 2011 at 06:40 UTC ( #928019=note: print w/ replies, xml ) Need Help??


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

This works as desired for me:

void modSV( SV *ref ) { SV *sv = SvRV( ref ); unsigned __int64 uv = 9223372036854775809ull; sv_setuv(sv, uv); }
Outputs:
SV = IV(0x381af90) at 0x381afa0 REFCNT = 1 FLAGS = (PADMY,IOK,pIOK) IV = 123 SV = IV(0x381af90) at 0x381afa0 REFCNT = 1 FLAGS = (PADMY,IOK,pIOK,IsUV) UV = 9223372036854775809
Haven't yet investigated why/where your approach falls down.

Cheers,
Rob


Comment on Re: XS: returning a 64-bit unsigned int?
Select or Download Code
Replies are listed 'Best First'.
Re^2: XS: returning a 64-bit unsigned int?
by BrowserUk (Pope) on Sep 27, 2011 at 06:53 UTC

    Perfect, thank you.

    ( Why on earth is that documented under SV-Body-Allocation and not SV-Manipulation-Functions? )


    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.

      sv_setuv_mg(sv, uv); is actually what you want unless you follow the sv_setuv(sv, uv); with SvSETMAGIC(sv);.

        Are you sure? (And can you explain why magic is needed?)

        Because it seems to work just fine without any magic?


        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://928019]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2015-07-28 10:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls