File tree Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -3614,24 +3614,11 @@ extension SignedInteger where Self: FixedWidthInteger {
3614
3614
/// Returns the given integer as the equivalent value in a different integer
3615
3615
/// type.
3616
3616
///
3617
- /// The `numericCast(_:)` function traps on overflow in `-O` and `-Onone`
3618
- /// builds.
3619
- ///
3620
- /// You can use `numericCast(_:)` to convert a value when the destination type
3621
- /// can be inferred from the context. In the following example, the
3622
- /// `random(in:)` function uses `numericCast(_:)` twice to convert the
3623
- /// argument and return value of the `arc4random_uniform(_:)` function to the
3624
- /// appropriate type.
3625
- ///
3626
- /// func random(in range: Range<Int>) -> Int {
3627
- /// return numericCast(arc4random_uniform(numericCast(range.count)))
3628
- /// + range.lowerBound
3629
- /// }
3630
- ///
3631
- /// let number = random(in: -10...<10)
3632
- /// // number == -3, perhaps
3617
+ /// Calling the `numericCast(_:)` function is equivalent to calling an
3618
+ /// initializer for the destination type. `numericCast(_:)` traps on overflow
3619
+ /// in `-O` and `-Onone` builds.
3633
3620
///
3634
- /// - Parameter x: The integer to convert, and instance of type `T`.
3621
+ /// - Parameter x: The integer to convert, an instance of type `T`.
3635
3622
/// - Returns: The value of `x` converted to type `U`.
3636
3623
@inlinable
3637
3624
public func numericCast< T: BinaryInteger , U: BinaryInteger > ( _ x: T ) -> U {
You can’t perform that action at this time.
0 commit comments