Skip to content

Commit e48b495

Browse files
author
Franziska Geiger
committed
Change Bytes mutiplication specializations
1 parent cf85364 commit e48b495

File tree

1 file changed

+5
-10
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/bytes

1 file changed

+5
-10
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/bytes/BytesBuiltins.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
import com.oracle.graal.python.nodes.function.builtins.PythonBinaryBuiltinNode;
6666
import com.oracle.graal.python.nodes.function.builtins.PythonTernaryBuiltinNode;
6767
import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
68+
import com.oracle.graal.python.nodes.util.CastToIndexNode;
6869
import com.oracle.graal.python.runtime.exception.PythonErrorType;
6970
import com.oracle.graal.python.runtime.sequence.storage.ByteSequenceStorage;
7071
import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage;
@@ -292,16 +293,10 @@ public Object mul(PBytes self, int times,
292293
}
293294

294295
@Specialization
295-
public Object mul(PBytes self, double times,
296-
@Cached("create()") SequenceStorageNodes.RepeatNode repeatNode) {
297-
SequenceStorage res = repeatNode.execute(self.getSequenceStorage(), (int) times);
298-
return factory().createBytes(res);
299-
}
300-
301-
@Specialization
302-
public Object mul(PBytes self, long times,
303-
@Cached("create()") SequenceStorageNodes.RepeatNode repeatNode) {
304-
SequenceStorage res = repeatNode.execute(self.getSequenceStorage(), (int) times);
296+
public Object mul(PBytes self, Object times,
297+
@Cached("create()") SequenceStorageNodes.RepeatNode repeatNode,
298+
@Cached("create()") CastToIndexNode castToInt) {
299+
SequenceStorage res = repeatNode.execute(self.getSequenceStorage(), castToInt.execute(times));
305300
return factory().createBytes(res);
306301
}
307302

0 commit comments

Comments
 (0)