Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #12599

Re: signed int64 pack/unpack

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: signed int64 pack/unpack
Date 2014-01-11 22:01 -0500
Organization A noiseless patient Spider
Message-ID <lat0hv$sl$1@dont-email.me> (permalink)
References <13b7b4d5-1ae0-4e04-910b-112f9a1631cc@googlegroups.com> <0.27f2c8a43d10a3f72059.20140112024221GMT.87fvot3oqa.fsf@bsb.me.uk>

Show all headers | View raw


On 1/11/2014 9:42 PM, Ben Bacarisse wrote:
> cameron7@gmail.com writes:
>
>> I'm having a bit of trouble figuring out a straightforward way to
>> "pack" / "unpack" a signed int64.
>>
>> I'm on a 64-bit machine, but the 'i' and 'I' are coming back with
>> 4-byte length.
>
> There is no explicit format for 64-bit ints.  The i/I formats are used
> for a native "int" but that need not be 64 bits on a 64-bit machine.
> The function is borrowed from Perl whose documentation says a bit more
>
>    This 'integer' is _at_least_ 32 bits wide.  Its exact size depends on
>    what a local C compiler calls 'int'.
>
> On my 64-bit Linux machine, 'int' is 32 bits.
>

On my 64 bit Linux system, 'int' is 64 bits.  But then I have the 64 bit 
PHP version (and 64 bit OS) loaded.

What do you get when you do:

<?php
echo PHP_INT_MAX . "\n";
?>


-- 
==================
Remove the "x" from my email address
Jerry Stuckle
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

signed int64 pack/unpack cameron7@gmail.com - 2014-01-11 18:18 -0800
  Re: signed int64 pack/unpack Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-11 21:35 -0500
    Re: signed int64 pack/unpack cameron7@gmail.com - 2014-01-11 18:46 -0800
      Re: signed int64 pack/unpack The Natural Philosopher <tnp@invalid.invalid> - 2014-01-12 02:59 +0000
        Re: signed int64 pack/unpack Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-11 22:03 -0500
        Re: signed int64 pack/unpack cameron7@gmail.com - 2014-01-11 19:10 -0800
      Re: signed int64 pack/unpack Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-11 22:04 -0500
  Re: signed int64 pack/unpack Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-12 02:42 +0000
    Re: signed int64 pack/unpack Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-11 22:01 -0500
      Re: signed int64 pack/unpack cameron7@gmail.com - 2014-01-11 19:08 -0800
      Re: signed int64 pack/unpack Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-12 03:11 +0000
        Re: signed int64 pack/unpack Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-11 22:15 -0500
          Re: signed int64 pack/unpack Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-12 12:37 +0000
            Re: signed int64 pack/unpack Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-12 10:51 -0500
              Re: signed int64 pack/unpack Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-12 17:00 +0100
                Re: signed int64 pack/unpack Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-12 16:09 -0500
                Re: signed int64 pack/unpack Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-12 22:35 +0000
                Re: signed int64 pack/unpack Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-12 17:59 -0500
                Re: signed int64 pack/unpack Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-13 01:59 +0000
              Re: signed int64 pack/unpack Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-12 22:30 +0000
    Re: signed int64 pack/unpack cameron7@gmail.com - 2014-01-11 21:54 -0800
      Re: signed int64 pack/unpack cameron7@gmail.com - 2014-01-12 07:25 -0800
        Re: signed int64 pack/unpack Jerry Stuckle <jstucklex@attglobal.net> - 2014-01-12 11:11 -0500
        Re: signed int64 pack/unpack Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-12 23:27 +0000
          Re: signed int64 pack/unpack cameron7@gmail.com - 2014-01-12 16:03 -0800
          Re: signed int64 pack/unpack cameron7@gmail.com - 2014-01-12 16:22 -0800
            Re: signed int64 pack/unpack Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-01-13 01:20 +0000
  Re: signed int64 pack/unpack Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-12 17:37 +0100

csiph-web