mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Re-instate "stdlib: Add some inlining attributes to help the optimizer getting the right inlining decisions."
This re-instates commit 8b0e36779e
This commit is contained in:
@@ -307,22 +307,25 @@ public struct _StringCore {
|
||||
|
||||
/// Get the Nth UTF-16 Code Unit stored.
|
||||
public subscript(position: Int) -> UTF16.CodeUnit {
|
||||
_precondition(
|
||||
position >= 0,
|
||||
"subscript: index precedes String start")
|
||||
@inline(__always)
|
||||
get {
|
||||
_precondition(
|
||||
position >= 0,
|
||||
"subscript: index precedes String start")
|
||||
|
||||
_precondition(
|
||||
position <= count,
|
||||
"subscript: index points past String end")
|
||||
_precondition(
|
||||
position <= count,
|
||||
"subscript: index points past String end")
|
||||
|
||||
if _fastPath(_baseAddress != nil) {
|
||||
return _nthContiguous(position)
|
||||
}
|
||||
if _fastPath(_baseAddress != nil) {
|
||||
return _nthContiguous(position)
|
||||
}
|
||||
#if _runtime(_ObjC)
|
||||
return _cocoaStringSubscript(self, position)
|
||||
return _cocoaStringSubscript(self, position)
|
||||
#else
|
||||
_sanityCheckFailure("subscript: non-native string without objc runtime")
|
||||
_sanityCheckFailure("subscript: non-native string without objc runtime")
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// Write the string, in the given encoding, to output.
|
||||
@@ -519,6 +522,7 @@ public struct _StringCore {
|
||||
_invariantCheck()
|
||||
}
|
||||
|
||||
@inline(never)
|
||||
mutating func append(rhs: _StringCore) {
|
||||
_invariantCheck()
|
||||
let minElementWidth
|
||||
|
||||
Reference in New Issue
Block a user