Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Re: Re: Perl printing long long types

by BrowserUk (Patriarch)
on Jul 03, 2003 at 10:30 UTC ( [id://271117]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Perl printing long long types
in thread Perl printing long long types

Because it doesn't accept a single number as an argument? (It's for IP addresses)

I don't understand what you mean by this?

By way of recompense for my lack of understanding, you might find this bit from the 5.8 INSTALL doc interesting/useful?

=head2 64 bit support.

If your platform does not have 64 bits natively, but can simulate them with compiler flags and/or C<long long> or C<int64_t>, you can build a perl that uses 64 bits.

There are actually two modes of 64-bitness: the first one is achieved using Configure -Duse64bitint and the second one using Configure -Duse64bitall. The difference is that the first one is minimal and the second one maximal. The first works in more places than the second.

The C<use64bitint> does only as much as is required to get 64-bit integers into Perl (this may mean, for example, using "long longs") while your memory may still be limited to 2 gigabytes (because your pointers could still be 32-bit). Note that the name C<64bitint> does not imply that your C compiler will be using 64-bit C<int>s (it might, but it doesn't have to): the C<use64bitint> means that you will be able to have 64 bits wide scalar values.

The C<use64bitall> goes all the way by attempting to switch also integers (if it can), longs (and pointers) to being 64-bit. This may create an even more binary incompatible Perl than -Duse64bitint: the resulting executable may not run at all in a 32-bit box, or you may have to reboot/reconfigure/rebuild your operating system to be 64-bit aware.

Which if I read it right, indicates that you can get 64-integers in perl even on 32-bit platforms as of 5.8.

You would have to re-compile to get it of course.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


Replies are listed 'Best First'.
Re: Re: Re: Re: Perl printing long long types
by jepri (Parson) on Jul 04, 2003 at 14:33 UTC
    I can see why you were confused by that post - so am I, reading it again. IP addresses fit into 32 bits, not 64 bits. That's what IPv6 is about.

    The recompile is a real pain for two reasons - one is that I don't like recompiling ( I use Debian. If I wanted to compile something, I would have installed Gentoo). The other is for my potential users - I doubt they'll be running Gentoo either.

    I did get by using byte strings, but now I'm being shot in the butt by packing and memory alignment issues. I think this is the time where I convert from perl to C. Sigh. I can see why C is still so strong. You compile it, and then it works. If it don't compile, it don't work. Unlike perl where it can compile and run for a while before blowing up.

    Thx for the interest, and the relevant manpage snippet. I assure you I searched, I just missed that bit of it.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

Re: Re: Re: Re: Perl printing long long types
by RollyGuy (Chaplain) on Jul 03, 2003 at 15:23 UTC
    You are correct. You CAN get 64 bit functionality on a 32 bit machine. To do that, the GNU compilier uses long longs which are 64 bits. If all that is needed is 64 bit data, then use64bitint should be sufficient. Also, a re-compile would be necessary.

    After the recompile, the quad packing will also be avaliable. A Quadword is just what is sounds like: four words. A long is two words, so a long long is four words which is equivalent to a quadword.

      ...long long is four words which is equivalent to a quadword.

      That's pretty much what I thought, but the OP seemed to be making a distinction, and never having used a C compiler on a 64-bit platform, I wasn't prepared to come straight out and state that, hence my question:)


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller


Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-03-28 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found