index(n, stepsFrom: i)

M-x findr-query-replace

\<advance(\([^:]+?\),\([
]+\)by: *\([^(),]*\|[^(),]+([^()]*)[^(),]*\)\(,\(?:[
]+\)limit: *\(?:[^()]*\|[^()]+([^()]*)[^()]*\)\)?)

index(\3,\2stepsFrom: \1\4)
This commit is contained in:
Dave Abrahams
2016-03-25 17:54:39 -07:00
parent 11259d1d14
commit 01127b32d5
31 changed files with 157 additions and 157 deletions

View File

@@ -721,13 +721,13 @@ internal func _transcodeSomeUTF16AsUTF8<
// Replace it with U+FFFD.
r = 0xbdbfef
scalarUtf8Length = 3
} else if _slowPath(input.advance(nextIndex, by: 1) == endIndex) {
} else if _slowPath(input.index(1, stepsFrom: nextIndex) == endIndex) {
// We have seen a high-surrogate and EOF, so we have an ill-formed
// sequence. Replace it with U+FFFD.
r = 0xbdbfef
scalarUtf8Length = 3
} else {
let unit1 = UInt(input[input.advance(nextIndex, by: 1)])
let unit1 = UInt(input[input.index(1, stepsFrom: nextIndex)])
if _fastPath((unit1 >> 10) == 0b1101_11) {
// `unit1` is a low-surrogate. We have a well-formed surrogate
// pair.
@@ -755,7 +755,7 @@ internal func _transcodeSomeUTF16AsUTF8<
result |= numericCast(r) << shift
utf8Count += scalarUtf8Length
}
nextIndex = input.advance(nextIndex, by: utf16Length)
nextIndex = input.index(utf16Length, stepsFrom: nextIndex)
}
// FIXME: Annoying check, courtesy of <rdar://problem/16740169>
if utf8Count < sizeofValue(result) {