Skip to content

Commit df6a56e

Browse files
committed
[stdlib] Make a stylistic change per reviewer feedback.
1 parent e19bb87 commit df6a56e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/public/core/Integers.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,12 +1672,12 @@ extension BinaryInteger {
16721672
if Self.isSigned {
16731673
return lhs.bitWidth > rhs.bitWidth ? // (1)
16741674
lhs == Self(truncatingIfNeeded: rhs) :
1675-
lhs < (0 as Self) ? false : Other(truncatingIfNeeded: lhs) == rhs // (2)
1675+
(lhs >= (0 as Self) && Other(truncatingIfNeeded: lhs) == rhs) // (2)
16761676
}
16771677
// Analogous reasoning applies if `Other` is signed but `Self` is not.
16781678
return lhs.bitWidth < rhs.bitWidth ?
16791679
Other(truncatingIfNeeded: lhs) == rhs :
1680-
rhs < (0 as Other) ? false : lhs == Self(truncatingIfNeeded: rhs)
1680+
(rhs >= (0 as Other) && lhs == Self(truncatingIfNeeded: rhs))
16811681
}
16821682

16831683
/// Returns a Boolean value indicating whether the two given values are not
@@ -1731,12 +1731,12 @@ extension BinaryInteger {
17311731
if Self.isSigned {
17321732
return lhs.bitWidth > rhs.bitWidth ? // (1)
17331733
lhs < Self(truncatingIfNeeded: rhs) :
1734-
lhs < (0 as Self) ? true : Other(truncatingIfNeeded: lhs) < rhs // (2)
1734+
(lhs < (0 as Self) || Other(truncatingIfNeeded: lhs) < rhs) // (2)
17351735
}
17361736
// Analogous reasoning applies if `Other` is signed but `Self` is not.
17371737
return lhs.bitWidth < rhs.bitWidth ?
17381738
Other(truncatingIfNeeded: lhs) < rhs :
1739-
rhs < (0 as Other) ? false : lhs < Self(truncatingIfNeeded: rhs)
1739+
(rhs > (0 as Other) && lhs < Self(truncatingIfNeeded: rhs))
17401740
}
17411741

17421742
/// Returns a Boolean value indicating whether the value of the first

0 commit comments

Comments
 (0)