Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: unpacking unsigned long longs

by ikegami (Patriarch)
on Jul 02, 2009 at 22:48 UTC ( [id://776861]=note: print w/replies, xml ) Need Help??


in reply to unpacking unsigned long longs

I can see that there isn't a letter symbol for those,

More like you can't see that there is a letter symbol for those. Several symbols, actually. Here's a convenient table of them:

Byte orderUnsignedSigned
Local System'sQq
NetworkQ>q>
Little-EndianQ<q<

Of course, that only works on builds of Perl that can actually support integers that large.

Replies are listed 'Best First'.
Re^2: unpacking unsigned long longs
by Anonymous Monk on Jul 03, 2009 at 22:09 UTC
    More like you can't see that there is a letter symbol for those.
    Is the condescending attitude really necessary here? If I may suggest the following alternate wording:
    You probably just missed it (which can be easy to do amongst the many letter symbols that pack uses):
    Then give your little table... (I like it when you do that in your nodes. Everything is suddenly clear and understandable. You are good at those tables.)

    See how easy that is? Do you not feel better taking a positive slant rather than starting with a deliberate insult?

Re^2: unpacking unsigned long longs
by questionnaire (Novice) on Jul 06, 2009 at 12:39 UTC
    So I guess "Quad" means 4 int lengths? That makes sense, and also explains why I didn't find anything while searching through docs for "long long". Thanks!

      So I guess "Quad" means 4 int lengths?

      Both this question and your original question are very ambiguous.

      • A C int is at least 16 bits.
      • A C long is at least 32 bits.
      • A C long long is at least 64 bits.

      I can't divine what your language and compiler chooses for int and long long, so please stop asking question in terms of ints and ask them in terms of bits or bytes.

        I can't divine what your language and compiler chooses for int and long long, so please stop asking question in terms of ints and ask them in terms of bits or bytes.
        The point is that the size of an int or long long depends on which compiler you are using. So as you can see, it is better to discuss these things in terms of bits or bytes (not int and long long) since that makes it clear what you are talking about.
        Ok. Sure: I was asking if a Quad was 8 bytes long.
Re^2: unpacking unsigned long longs
by questionnaire (Novice) on Jul 06, 2009 at 14:50 UTC
    Also: is there an easy way to tell if I have perl compiled to support numbers that large?

      The necessary info is in Config.

      $ perl -MConfig -le'print $Config{ivsize}' 4

      You can see that value in perl -V as well.

      Of course, you could just try unpack 'Q'.

      $ perl -le'unpack "Q", chr(0)x8; print "ok"' Invalid type 'Q' in unpack at -e line 1.
        I take it ivsize==4 is good for what I want?
        Alright, so I tried unpacking Q (and q) to no avail. But perl didn't spit out any errors when I try to assign 2^45 to a variable and then print it. Does that still mean perl isn't compiled to support 64 bit numbers? If so, how can I go about fixing this?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-26 04:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found