Skip to content

Commit f7075cc

Browse files
committed
Add a link to BinaryInteger.init(clamping:) in the section on new saturating arithmetic API.
1 parent fe15113 commit f7075cc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/IntegerUtilities/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ let c = x.addingWithSaturation(y) // saturates to 127
6363
There is one other method, `shiftedWithSaturation(leftBy:rounding:)`,
6464
which performs a bitwise shift with rounding and saturation.
6565

66+
If you are using saturating arithmetic, you may also want to perform
67+
saturating conversions between integer types; this functionality is provided
68+
by the standard library via the [`init(clamping:)` API]
69+
(https://developer.apple.com/documentation/swift/binaryinteger/init(clamping:))
70+
6671
## Types
6772

6873
The `RoundingRule` enum is used with shift, division, and round operations to specify how to round their results to a representable value.

0 commit comments

Comments
 (0)