diff --git a/src/unicode/letter.go b/src/unicode/letter.go index 90b0b414da297..4d9fc67165cf8 100644 --- a/src/unicode/letter.go +++ b/src/unicode/letter.go @@ -97,7 +97,7 @@ func is16(ranges []Range16, r uint16) bool { return false } if r <= range_.Hi { - return (r-range_.Lo)%range_.Stride == 0 + return range_.Stride == 1 || (r-range_.Lo)%range_.Stride == 0 } } return false @@ -110,7 +110,7 @@ func is16(ranges []Range16, r uint16) bool { m := lo + (hi-lo)/2 range_ := &ranges[m] if range_.Lo <= r && r <= range_.Hi { - return (r-range_.Lo)%range_.Stride == 0 + return range_.Stride == 1 || (r-range_.Lo)%range_.Stride == 0 } if r < range_.Lo { hi = m @@ -130,7 +130,7 @@ func is32(ranges []Range32, r uint32) bool { return false } if r <= range_.Hi { - return (r-range_.Lo)%range_.Stride == 0 + return range_.Stride == 1 || (r-range_.Lo)%range_.Stride == 0 } } return false @@ -143,7 +143,7 @@ func is32(ranges []Range32, r uint32) bool { m := lo + (hi-lo)/2 range_ := ranges[m] if range_.Lo <= r && r <= range_.Hi { - return (r-range_.Lo)%range_.Stride == 0 + return range_.Stride == 1 || (r-range_.Lo)%range_.Stride == 0 } if r < range_.Lo { hi = m