Bug #17116 Updated: Bitwise & does not give expected results for positive numbers

From: Date: Mon, 01 Jul 2002 19:41:23 +0000
Subject: Bug #17116 Updated: Bitwise & does not give expected results for positive numbers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-12704@lists.php.net to get a copy of this message
ID: 17116 Updated by: derick@php.net Reported By: lindsay.marshall@ncl.ac.uk -Status: Feedback +Status: No Feedback Bug Type: Math related Operating System: redhat 7.2 PHP Version: 4.2.0 New Comment: Please reopen this report if this problem is still not fixed for you. Derick Previous Comments: ------------------------------------------------------------------------ [2002-05-09 09:08:35] rasmus@php.net 1) You sure you aren't &'ing strings together? 2) 7755 has been fixed - try it 3) Doubt that ------------------------------------------------------------------------ [2002-05-09 08:32:33] lindsay.marshall@ncl.ac.uk Oh, and before you say "BOGUS - see 7755" 1) I am not using negative integers 2) I think that 7755 is a serious bug and needs to be fixed properly as someone else commented. 3) It is clearly intermittent or at least depends on past history in some way. ------------------------------------------------------------------------ [2002-05-09 08:27:17] lindsay.marshall@ncl.ac.uk I just tried the following: $a1 = $r->status; $a2 = $current->mask; echo $a1.' '.$a2.' '.($a1&$a2); And it still prints out 8191 7 0 I feel as though I am doing something really stupid here, but cannot for the life of me see what it is. ------------------------------------------------------------------------ [2002-05-09 08:17:02] lindsay.marshall@ncl.ac.uk I have a piece of code that effectively does this : $r->f = 8191; $c->m = 7; $r->f & $c->m returns 0!! The above code works fine when tested standalone, but the equivalent code in my program generates 0. I can write ; echo $r->status.' '.$current->mask.' '.($r->status&$current->mask); and the output I get is 8191 7 0 If I write : $a1=7;$a2=8191; echo $r->status.' '.$current->mask.' '.($a1&$a2); I get 8191 7 7 Something is getting confused somewhere!! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17116&edit=1

« previous php.bugs (#12704) next »