in reply to printf formatting 32 bit values

If you and the value with 0xffffffff, it will trim it to 32-bits:

print unpack 'Q', pack 'Q', -1;; 18446744073709551615 print unpack 'Q', pack 'Q', -1 & 0xffffffff;; 4294967295

Is that the sort of thing you are looking for?


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.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^2: printf formatting 32 bit values
by bcreane (Novice) on Sep 28, 2010 at 21:47 UTC
    Yep, that does it. The pack'ing was the part I was missing ... sign extending 0x000000000ffffffff didn't work.

    thank you