@@ -538,8 +538,13 @@ boolean startsWith(String self, String prefix, long start, long end) {
538
538
return doIt (self , prefix , correctIndex (start , self ), correctIndex (end , self ));
539
539
}
540
540
541
- @ Specialization
541
+ @ Specialization ( rewriteOn = ArithmeticException . class )
542
542
boolean startsWith (String self , String prefix , PInt start , @ SuppressWarnings ("unused" ) PNone end ) {
543
+ return startsWith (self , prefix , start .intValueExact (), self .length ());
544
+ }
545
+
546
+ @ Specialization
547
+ boolean startsWithPIntOvf (String self , String prefix , PInt start , @ SuppressWarnings ("unused" ) PNone end ) {
543
548
return doIt (self , prefix , correctIndex (start , self ), self .length ());
544
549
}
545
550
@@ -563,11 +568,16 @@ boolean startsWith(String self, PTuple prefix, long start, long end) {
563
568
return doIt (self , prefix , correctIndex (start , self ), correctIndex (end , self ));
564
569
}
565
570
566
- @ Specialization
571
+ @ Specialization ( rewriteOn = ArithmeticException . class )
567
572
boolean startsWith (String self , PTuple prefix , PInt start , @ SuppressWarnings ("unused" ) PNone end ) {
573
+ return startsWith (self , prefix , start .intValueExact (), end );
574
+ }
575
+
576
+ @ Specialization
577
+ boolean startsWithPIntOvf (String self , PTuple prefix , PInt start , @ SuppressWarnings ("unused" ) PNone end ) {
568
578
return doIt (self , prefix , correctIndex (start , self ), self .length ());
569
579
}
570
-
580
+
571
581
@ Specialization
572
582
boolean startsWith (String self , PTuple prefix , @ SuppressWarnings ("unused" ) PNone start , @ SuppressWarnings ("unused" ) PNone end ) {
573
583
return startsWith (self , prefix , 0 , self .length ());
0 commit comments