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

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

by syphilis (Archbishop)
on Sep 27, 2011 at 06:40 UTC ( [id://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

Replies are listed 'Best First'.
Re^2: XS: returning a 64-bit unsigned int?
by BrowserUk (Patriarch) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://928019]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 04:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found