Skip to content

Commit

Permalink
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1328,6 +1328,28 @@ public Object rightShift(VirtualFrame frame, int a, int b) {
}
}

@Specialization
public Object rightShift(VirtualFrame frame, int a, long b) {
if (b > 0) {
if (b >= BITS - 1) {
if (a < 0) {
return -1;
} else {
return 0;
}
} else {
return a >> b;
}
} else {
if (leftShiftNode == null) {
CompilerDirectives.transferToInterpreter();
leftShiftNode = insert(FixnumNodesFactory.LeftShiftNodeFactory.create(getContext(), getSourceSection(), new RubyNode[]{null, null}));
}

return leftShiftNode.executeLeftShift(frame, a, -b);
}
}

@Specialization
public Object rightShift(VirtualFrame frame, long a, int b) {
if (b > 0) {

0 comments on commit 787bdf0

Please sign in to comment.