php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11519 Problem with bitwise & operator and big integers
Submitted: 2001-06-17 10:16 UTC Modified: 2001-06-17 14:08 UTC
From: Andreas dot Schwarz at schwarzes dot net Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 4.0.5 OS: SunOS
Private report: No CVE-ID: None
 [2001-06-17 10:16 UTC] Andreas dot Schwarz at schwarzes dot net
If I use the bitwise "&" operator with an integer (bit 32 is set), the result
is wrong.

<?
/*
** result is wrong (1)*/
 
  $a = 4294901760; /* 11111111111111110000000000000000 */
  $b = 1;          /* 00000000000000000000000000000001 */
 
  $c = $a & $b;
 
  printf("$c = $a & $b<BR>");
 
/*
** result is ok (0) */
 
  $a = 2147450880; /* 1111111111111111000000000000000 */
  $b = 1;          /* 0000000000000000000000000000001 */
 
  $c = $a & $b;
 
  printf("$c = $a & $b<BR>");
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-17 14:08 UTC] sniper@php.net
See this bug report for reason why this is bogus report:

http://www.php.net/bugs.php?id=7755&edit=1

Also I suggest you READ the instructions about submitting
bug reports BEFORE you submit one.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC