From 37a6521d43ae169cb9425b8ecd19df362c37cf7e Mon Sep 17 00:00:00 2001
From: stepan <stepan.sindelar@oracle.com>
Date: Tue, 15 Aug 2017 17:59:24 +0200
Subject: [PATCH] Fix: bitwise shift with negative n returns NA

---
 .../oracle/truffle/r/nodes/builtin/base/BitwiseFunctions.java | 4 ++--
 documentation/graphics.md                                     | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BitwiseFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BitwiseFunctions.java
index dc67759ab2..6f8b4034f2 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BitwiseFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BitwiseFunctions.java
@@ -91,14 +91,14 @@ public class BitwiseFunctions {
                             v = aVal ^ bVal;
                             break;
                         case SHIFTR:
-                            if (bVal > 31) {
+                            if (bVal > 31 || bVal < 0) {
                                 v = RRuntime.INT_NA;
                             } else {
                                 v = aVal >>> bVal;
                             }
                             break;
                         case SHIFTL:
-                            if (bVal > 31) {
+                            if (bVal > 31 || bVal < 0) {
                                 v = RRuntime.INT_NA;
                             } else {
                                 v = aVal << bVal;
diff --git a/documentation/graphics.md b/documentation/graphics.md
index e940d16f39..8cd2bfb9a4 100644
--- a/documentation/graphics.md
+++ b/documentation/graphics.md
@@ -94,3 +94,4 @@ FastR's grid implementation does not yet support:
 
 FastR does not plan to implement the R graphics engine display list
 and related functions. However, the grid display list is implemented.
+
-- 
GitLab