Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix string bitwise op semantics.
Strings of different lengths want The Other Thing.

With this, all Rakudo sanity tests pass on JVM.
  • Loading branch information
jnthn committed Jun 20, 2013
1 parent 23a3a11 commit f4a8406
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
Expand Up @@ -2851,9 +2851,9 @@ public static String bitor_s(String a, String b) {
StringBuilder r = new StringBuilder(mlength);
int apos = 0;
int bpos = 0;
while (apos < alength || bpos < blength) {
int cpa = apos < alength ? a.codePointAt(apos) : 0;
int cpb = bpos < blength ? b.codePointAt(bpos) : 0;
while (apos < alength && bpos < blength) {
int cpa = a.codePointAt(apos);
int cpb = b.codePointAt(bpos);
r.appendCodePoint(cpa | cpb);
apos += Character.charCount(cpa);
bpos += Character.charCount(cpb);
Expand All @@ -2868,9 +2868,9 @@ public static String bitxor_s(String a, String b) {
StringBuilder r = new StringBuilder(mlength);
int apos = 0;
int bpos = 0;
while (apos < alength || bpos < blength) {
int cpa = apos < alength ? a.codePointAt(apos) : 0;
int cpb = bpos < blength ? b.codePointAt(bpos) : 0;
while (apos < alength && bpos < blength) {
int cpa = a.codePointAt(apos);
int cpb = b.codePointAt(bpos);
r.appendCodePoint(cpa ^ cpb);
apos += Character.charCount(cpa);
bpos += Character.charCount(cpb);
Expand All @@ -2885,9 +2885,9 @@ public static String bitand_s(String a, String b) {
StringBuilder r = new StringBuilder(mlength);
int apos = 0;
int bpos = 0;
while (apos < alength || bpos < blength) {
int cpa = apos < alength ? a.codePointAt(apos) : 0;
int cpb = bpos < blength ? b.codePointAt(bpos) : 0;
while (apos < alength && bpos < blength) {
int cpa = a.codePointAt(apos);
int cpb = b.codePointAt(bpos);
r.appendCodePoint(cpa & cpb);
apos += Character.charCount(cpa);
bpos += Character.charCount(cpb);
Expand Down

0 comments on commit f4a8406

Please sign in to comment.