Commits

Anonymous committed aac405e

Applied patch from smsmith++.
Fix ^ as bitwise xor not power.
Forces ^, & and | bitwise operators to only work on integers.

Comments (0)

Files changed (2)

Lib/test/parrot/op-bitwise.py

 print 'success:', (0 | 1) + 6
 print 'test: 8'
 print 'success:', (1 | 1) + 7
+
+# ^
+
+print 'test: 9'
+print 'success:', (0 ^ 0) + 9
+print 'test: 10'
+print 'success:', (1 ^ 0) + 9
+print 'test: 11'
+print 'success:', (0 ^ 1) + 10
+print 'test: 12'
+print 'success:', (1 ^ 1) + 12
+
+

src/builtins/oper.pir

 .end
 
 .sub 'infix:^'
-    .param num a
-    .param num b
-    $N0 = pow a, b
-    .return ($N0)
+    .param int a
+    .param int b
+    $I0 = bxor a, b
+    .return ($I0)
 .end
 
 .sub 'infix:&'
-    .param pmc a
-    .param pmc b
-    $I0 = istrue a
-    $I1 = istrue b
-    $I0 = and $I0, $I1
+    .param int a
+    .param int b
+    $I0 = band a, b
     .return ($I0)
 .end
 
 .sub 'infix:|'
-    .param pmc a
-    .param pmc b
-    $I0 = istrue a
-    $I1 = istrue b
-    $I0 = or $I0, $I1
+    .param int a
+    .param int b
+    $I0 = bor a, b
     .return ($I0)
 .end
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.