Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #12605
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: signed int64 pack/unpack |
| Date | 2014-01-11 22:15 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <lat1bd$3nc$1@dont-email.me> (permalink) |
| References | <13b7b4d5-1ae0-4e04-910b-112f9a1631cc@googlegroups.com> <0.27f2c8a43d10a3f72059.20140112024221GMT.87fvot3oqa.fsf@bsb.me.uk> <lat0hv$sl$1@dont-email.me> <0.67d46155d5b1c3fc2de6.20140112031127GMT.874n593nds.fsf@bsb.me.uk> |
On 1/11/2014 10:11 PM, Ben Bacarisse wrote: > Jerry Stuckle <jstucklex@attglobal.net> writes: > >> 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. > > Yes, me too. > >> What do you get when you do: >> >> <?php >> echo PHP_INT_MAX . "\n"; >> ?> > > Same as you but I don't think that's relevant. PHP stores values > internally using a C long. I think the Perl document describes what's > really happening. > It is totally relevant. You can't operate on 64 bit values if you don't have 64 bit support. And this is PHP, not Perl. Things have changed a *lot* since the original versions were created. Much of the Perl documentation no longer applies to PHP (if it ever did). -- ================== 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
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