Skip to content

Commit c4a5f2f

Browse files
committed
Use the intrinsified ArrayUtils.indexOf for ByteSequenceStorage#indexOfByte
1 parent 44adb2b commit c4a5f2f

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/sequence/storage/ByteSequenceStorage.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import com.oracle.graal.python.nodes.ErrorMessages;
3636
import com.oracle.graal.python.nodes.PRaiseNode;
3737
import com.oracle.graal.python.util.PythonUtils;
38+
import com.oracle.truffle.api.ArrayUtils;
3839
import com.oracle.truffle.api.library.ExportLibrary;
3940
import com.oracle.truffle.api.library.ExportMessage;
4041

@@ -160,13 +161,7 @@ public ByteSequenceStorage getSliceInBound(int start, int stop, int step, int sl
160161
}
161162

162163
public int indexOfByte(byte value) {
163-
for (int i = 0; i < length; i++) {
164-
if (values[i] == value) {
165-
return i;
166-
}
167-
}
168-
169-
return -1;
164+
return ArrayUtils.indexOf(values, 0, length, value);
170165
}
171166

172167
public int indexOfInt(int value) {

0 commit comments

Comments
 (0)