bitwiseNot_basiclong_64bit.phpt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. --TEST--
  2. Test ~N operator : 64bit long tests
  3. --SKIPIF--
  4. <?php
  5. if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
  6. ?>
  7. --FILE--
  8. <?php
  9. define("MAX_64Bit", 9223372036854775807);
  10. define("MAX_32Bit", 2147483647);
  11. define("MIN_64Bit", -9223372036854775807 - 1);
  12. define("MIN_32Bit", -2147483647 - 1);
  13. $longVals = array(
  14. MAX_64Bit, MIN_64Bit, MAX_32Bit, MIN_32Bit, MAX_64Bit - MAX_32Bit, MIN_64Bit - MIN_32Bit,
  15. MAX_32Bit + 1, MIN_32Bit - 1, MAX_32Bit * 2, (MAX_32Bit * 2) + 1, (MAX_32Bit * 2) - 1,
  16. MAX_64Bit -1, MAX_64Bit + 1, MIN_64Bit + 1, MIN_64Bit - 1
  17. );
  18. foreach ($longVals as $longVal) {
  19. echo "--- testing: $longVal ---\n";
  20. var_dump(~$longVal);
  21. }
  22. ?>
  23. ===DONE===
  24. --EXPECT--
  25. --- testing: 9223372036854775807 ---
  26. int(-9223372036854775808)
  27. --- testing: -9223372036854775808 ---
  28. int(9223372036854775807)
  29. --- testing: 2147483647 ---
  30. int(-2147483648)
  31. --- testing: -2147483648 ---
  32. int(2147483647)
  33. --- testing: 9223372034707292160 ---
  34. int(-9223372034707292161)
  35. --- testing: -9223372034707292160 ---
  36. int(9223372034707292159)
  37. --- testing: 2147483648 ---
  38. int(-2147483649)
  39. --- testing: -2147483649 ---
  40. int(2147483648)
  41. --- testing: 4294967294 ---
  42. int(-4294967295)
  43. --- testing: 4294967295 ---
  44. int(-4294967296)
  45. --- testing: 4294967293 ---
  46. int(-4294967294)
  47. --- testing: 9223372036854775806 ---
  48. int(-9223372036854775807)
  49. --- testing: 9.2233720368548E+18 ---
  50. int(9223372036854775807)
  51. --- testing: -9223372036854775807 ---
  52. int(9223372036854775806)
  53. --- testing: -9.2233720368548E+18 ---
  54. int(9223372036854775807)
  55. ===DONE===