File tree 1 file changed +2
-8
lines changed
1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -263,10 +263,7 @@ func DecodeLastRune(p []byte) (r rune, size int) {
263
263
// guard against O(n^2) behavior when traversing
264
264
// backwards through strings with long sequences of
265
265
// invalid UTF-8.
266
- lim := end - UTFMax
267
- if lim < 0 {
268
- lim = 0
269
- }
266
+ lim := max (end - UTFMax , 0 )
270
267
for start -- ; start >= lim ; start -- {
271
268
if RuneStart (p [start ]) {
272
269
break
@@ -303,10 +300,7 @@ func DecodeLastRuneInString(s string) (r rune, size int) {
303
300
// guard against O(n^2) behavior when traversing
304
301
// backwards through strings with long sequences of
305
302
// invalid UTF-8.
306
- lim := end - UTFMax
307
- if lim < 0 {
308
- lim = 0
309
- }
303
+ lim := max (end - UTFMax , 0 )
310
304
for start -- ; start >= lim ; start -- {
311
305
if RuneStart (s [start ]) {
312
306
break
You can’t perform that action at this time.
0 commit comments