[stdlib] Rewrite UTF16.transcodedLength

This commit is contained in:
Dave Abrahams
2017-05-27 16:20:29 -07:00
parent 7db9ba8dd2
commit ceff7a5573
2 changed files with 30 additions and 13 deletions

View File

@@ -24,6 +24,18 @@ extension Unicode {
/// error (the length of the longest prefix of a valid encoding
/// sequence that could be recognized).
case error(length: Int)
@_versioned
internal var _valid: T? {
if case .valid(let result) = self { return result }
return nil
}
@_versioned
internal var _error: Int? {
if case .error(let result) = self { return result }
return nil
}
}
}