|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-02-10 10:18 UTC] tonyman_hacker at yahoo dot com
Description: ------------ I've founded that under Linux the ~ bit operator doesn't produce correct result; Reproduce code: --------------- $myvar = 0x1; $myvar = ~$myvar; // the result of this operation on windows system is correct // 0xFFFFFFFE // on Linux we have 0xFFFFFFFF echo dechex($myvar); Expected result: ---------------- // the result of this operation on windows system is correct // 0xFFFFFFFE // on Linux we have 0xFFFFFFFF Actual result: -------------- // the result of this operation on windows system is correct // 0xFFFFFFFE // on Linux we have 0xFFFFFFFF instead of this you could use XOR operator ... i.e. ~$myvar = $myvar ^ 0xFFFFFFFF PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 11:00:02 2025 UTC |
Works fine on linux. php -r ' printf("%x\n", ~ 0x1); ' fffffffe