Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #12623
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: signed int64 pack/unpack |
| Date | 2014-01-12 16:09 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <lav0ac$97f$1@dont-email.me> (permalink) |
| References | (3 earlier) <0.67d46155d5b1c3fc2de6.20140112031127GMT.874n593nds.fsf@bsb.me.uk> <lat1bd$3nc$1@dont-email.me> <0.b0c370f1186357b63eb1.20140112123753GMT.87sist1ila.fsf@bsb.me.uk> <laudl1$di1$1@dont-email.me> <52d2bbff$0$9507$9b4e6d93@newsspool1.arcor-online.net> |
On 1/12/2014 11:00 AM, Christoph Michael Becker wrote: > Jerry Stuckle wrote: > >> On 1/12/2014 7:37 AM, Ben Bacarisse wrote: >>> Jerry Stuckle <jstucklex@attglobal.net> writes: >>> >>>> 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. >>> >>> The Perl documentation seems to describe what's happening. The PHP >>> documentation leaves the nature of the integer of "machine dependent >>> size" unspecified so some clarification is helpful. >>> >>> 64 bit support may be necessary but it seems not to be sufficient. Many >>> 64 systems leave C's "int" as 32 bits, so if pack is still doing what >>> the Perl version describes, it's at least an explanation of what's >>> happening. >>> >>>> 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). >>> >>> I am sure that's true, but, other than the source, I don't think there >>> is much more to go on. What is your explanation of what's going on? >>> >> >> You can argue, or you can answer our questions and get help. >> >> I see you've already got the answers and all you want to do is argue. >> Sorry I wasted my time and the network's bandwidth trying to help you. > > Jerry, please note that Ben, to whom you've replied, is not the OP. :) > Yes, I know. But he keeps referring to information that is > 15 years old. PHP has changed a lot since then, but we just wants to argue. -- ================== 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