Bug #6368 Updated: Bitwise NOT does not work
| From: | yohgaki@php.net | Date: | Tue, 29 Jan 2002 01:13:17 +0000 |
| Subject: | Bug #6368 Updated: Bitwise NOT does not work | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-78378@lists.php.net to get a copy of this message | ||
ID: 6368
Updated by: yohgaki
Reported By: jonny@1409.org
Old Status: Open
Status: Closed
Bug Type: Feature/Change Request
Operating System: Linux 2.2.16
PHP Version: 4.0.1pl2
New Comment:
Is this feasible?
I think it's not, unless we support unsinged int/long type......
And it will be more confusing than bitwise operation....
Won't change.
Please feel free to reopen if you are willing to discuss more about
this.
Previous Comments:
------------------------------------------------------------------------
[2000-08-26 13:41:42] stas@php.net
And signed shift operations is not a bug, moving to feature request.
------------------------------------------------------------------------
[2000-08-26 13:40:57] stas@php.net
Why did you decide that -2 is 10000000000000000000000000000001? It
isn't.
------------------------------------------------------------------------
[2000-08-26 12:58:05] jonny@1409.org
Sorry, there's an error in my Bug report.
When I do a "~1" i get -2, not 2.
Sorry again...
------------------------------------------------------------------------
[2000-08-26 12:56:05] jonny@1409.org
Maybe i'm just too stupid, but this one is strange:
The logical operator ~ (bitwise NOT) does not behave as expected. When
doing a "~1" (00000000000000000000000000000001), i get
2 (10000000000000000000000000000001) so it only seems to
invert the first bit?!
Furthermore when doing some simple mathematicaloperations, PHP behaves
extremely annoing. Right-shifting (>>) a negative number will
always produce a negative result, i.e. the +/- bit gets not
shifted. Although you are right when you claim that this one is ok,
there are situations when you want the sign bit to get also shifted,
and there seems to be no simple way for doing that in PHP :-(
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=6368&edit=1