PHP developers,
Are the requirements for PHP 6 set in stone?
I saw in the minutes from the Paris meeting that a 64bit integer has
been proposed. I am curious if it would make sense to allow integers to
be both signed and unsigned. For me personally, I would love to have
unsigned 64bit integers.
I have a task that requires bitflag operations. Having only 16 bits to
deal with is really bad (I only care about positive int). Having 32
positive bits in PHP 6 is certainly an improvement, but if I can get all
64, then live would be much better.
http://www.php.net/~derick/meeting-notes.html#add-a-64bit-integer
Thanks,
Ezra
Ezra Nugroho wrote:
PHP developers,
Are the requirements for PHP 6 set in stone?
I saw in the minutes from the Paris meeting that a 64bit integer has
been proposed. I am curious if it would make sense to allow integers to
be both signed and unsigned. For me personally, I would love to have
unsigned 64bit integers.I have a task that requires bitflag operations. Having only 16 bits to
deal with is really bad (I only care about positive int). Having 32
positive bits in PHP 6 is certainly an improvement, but if I can get all
64, then live would be much better.
Uh, positive bits?
A bitfield is a bitfield. Signedness is irrelevant.
-Rasmus
Uh, positive bits?
A bitfield is a bitfield. Signedness is irrelevant.
-Rasmus
Yes.
I probably should say integers that I can modify with bitwise operators
comfortably without changing the signs. The problem is that people may
want to do comparison after doing bitwise operations. If the sign is
changed, the comparison will not be valid, right?
That's why I want to stay within the positive range.
Ezra Nugroho wrote:
Uh, positive bits?
A bitfield is a bitfield. Signedness is irrelevant.
-Rasmus
Yes.
I probably should say integers that I can modify with bitwise operators
comfortably without changing the signs. The problem is that people may
want to do comparison after doing bitwise operations. If the sign is
changed, the comparison will not be valid, right?That's why I want to stay within the positive range.
Take a look at
http://pecl.php.net/package/big_int/1.0.2
Andrey
Ezra Nugroho wrote:
I probably should say integers that I can modify with bitwise operators
comfortably without changing the signs. The problem is that people may
want to do comparison after doing bitwise operations. If the sign is
changed, the comparison will not be valid, right?That's why I want to stay within the positive range.
You just don't care about signedness:
mike@honeybadger:~/development/testimonials$ ./un_or_signed
-1 4294967295 4294967295 -1 EQUAL
mike@honeybadger:~/development/testimonials$ cat un_or_signed.c
#include <stdio.h>
int main(int argc, char *argv[])
{
signed i1 = -1;
unsigned i2 = -1;
printf("%d %u %u %d %s\n", i1, i2, i1, i2, i1==i2?"EQUAL":"DIFFER");
return 0;
}
Regards,
Michael - <mike(@)php.net> http://dev.iworks.at/ext-http/http-functions.html.gz
I have a task that requires bitflag operations. Having only 16 bits to
deal with is really bad (I only care about positive int). Having 32
positive bits in PHP 6 is certainly an improvement, but if I can get all
64, then live would be much better.
It's not as nice as native, but GMP allows arbitrary-length integers
and has bit-wise operators.
-adam
--
adam@trachtenberg.com | http://www.trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!