|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38225 ">>" gives unexpected results
Submitted: 2006-07-26 15:41 UTC Modified: 2006-08-14 22:14 UTC
From: bretschneider at cleverbridge dot com Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.1.4 OS: Linux 2.6.12-1.1381_FC3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bretschneider at cleverbridge dot com
New email:
PHP Version: OS:


 [2006-07-26 15:41 UTC] bretschneider at cleverbridge dot com
 ">>" gives unexpected results

Reproduce code:
$x = 0x00FFFF00;
printf("0x%8X\n", ($x >> 8));       // I get "0x    FFFF"
printf("0x%8X\n", ($x << 8) >> 8);  // I get 0xFFFFFF00 (bad)
printf("0x%8X\n", ($x << 0) >> 8);  // I get 0xFFFFFFFF (bad)

$x = 0xFFFFFFFF;
printf("0x%8X\n", ($x >> 8) << 8);  // I get 0xFFFFFF00 (bad)

Expected result:
0x    FFFF
0x  FFFF00
0x  FFFF00

Actual result:
0x    FFFF


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-14 22:14 UTC]
I can't reproduce anything. I get the same results with PHP and C (gcc 3.4).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 07:01:29 2024 UTC