Skip to content

Commit 5a29c92

Browse files
authored
Make Optional<T>.TangentVector methods inlineable (#78796)
1 parent 7484f01 commit 5a29c92

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stdlib/public/Differentiation/OptionalDifferentiation.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ extension Optional: Differentiable where Wrapped: Differentiable {
1919

2020
public var value: Wrapped.TangentVector?
2121

22+
@inlinable
2223
public init(_ value: Wrapped.TangentVector?) {
2324
self.value = value
2425
}
2526

27+
@inlinable
2628
public static var zero: Self {
2729
return Self(.zero)
2830
}
2931

32+
@inlinable
3033
public static func + (lhs: Self, rhs: Self) -> Self {
3134
switch (lhs.value, rhs.value) {
3235
case (nil, nil): return Self(nil)
@@ -36,6 +39,7 @@ extension Optional: Differentiable where Wrapped: Differentiable {
3639
}
3740
}
3841

42+
@inlinable
3943
public static func - (lhs: Self, rhs: Self) -> Self {
4044
switch (lhs.value, rhs.value) {
4145
case (nil, nil): return Self(nil)
@@ -45,13 +49,15 @@ extension Optional: Differentiable where Wrapped: Differentiable {
4549
}
4650
}
4751

52+
@inlinable
4853
public mutating func move(by offset: TangentVector) {
4954
if let value = offset.value {
5055
self.value?.move(by: value)
5156
}
5257
}
5358
}
5459

60+
@inlinable
5561
public mutating func move(by offset: TangentVector) {
5662
if let value = offset.value {
5763
self?.move(by: value)

0 commit comments

Comments
 (0)