bitwise.carbon 702 B

1234567891011121314151617181920212223242526272829
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. package ExplorerTest api;
  7. fn Main() -> i32 {
  8. if (^0 != -1) { return 11; }
  9. if (^1 != -2) { return 12; }
  10. if (^(-3) != 2) { return 13; }
  11. if (3 & 6 != 2) { return 21; }
  12. if (-1 & 4 != 4) { return 22; }
  13. if (-1 & -2 != -2) { return 23; }
  14. if (1 | 4 != 5) { return 31; }
  15. if (5 | 3 != 7) { return 32; }
  16. if (-2 | 1 != -1) { return 33; }
  17. if (1 ^ 4 != 5) { return 41; }
  18. if (5 ^ 3 != 6) { return 42; }
  19. if (-2 ^ -3 != 3) { return 43; }
  20. return 0;
  21. }
  22. // CHECK:STDOUT: result: 0