Re: double val to long val conversion issue

From: Date: Tue, 19 Feb 2013 23:53:17 +0000
Subject: Re: double val to long val conversion issue
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals 
Request: Send a blank email to internals+get-66008@lists.php.net to get a copy of this message
On Tue, 19 Feb 2013 03:07:37 +0100, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
If no one objects, I'll merge this into 5.5 and master: https://github.com/cataphract/php-src/compare/dval_to_lval
Maybe add UNEXPECTED around the if condition? Since it's marked as zend_always_inline I imagine it's supposed to be performance-sensitive...
I can add that.
Also, skip comments in tests seem to be wrong: +if (PHP_INT_SIZE != 4) 6 + die("skip for machines with 32-bit longs"); But actually it skips for longs NOT being 32-bit. Same with other test.
run-tests.php strips off the skip and shows only "for machines with 32-bit". The "skip" is necessary for the test to be skipped.
Also, I'm not sure I understand what 64-bit test is supposed to return and why - why negative number is converted to positive one? What exactly this change is supposed to improve?
The least significant bytes are preserved. Take int(-2056257536) and int(2943463994971652096): In[6]:= BitAnd[2^32 - 1, {-2056257536, 2943463994971652096}] Out[6]= {2238709760, 2238709760} -- Gustavo Lopes

« previous php.internals (#66008) next »