Re: Other Integers for php 6

From: Date: Thu, 09 Feb 2006 19:33:53 +0000
Subject: Re: Other Integers for php 6
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-21825@lists.php.net to get a copy of this message
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

« previous php.internals (#21825) next »