@@ -2995,134 +2995,6 @@ extension FixedWidthInteger {
2995
2995
else { self = Self ( truncatingIfNeeded: source) }
2996
2996
}
2997
2997
2998
- /// Returns the sum of this value and the given value without checking for
2999
- /// arithmetic overflow.
3000
- ///
3001
- /// Use this function only to avoid the cost of overflow checking when you
3002
- /// are certain that the operation won't overflow. In optimized builds (`-O`)
3003
- /// the compiler is free to assume that overflow won't occur. Failure to
3004
- /// satisfy that assumption is a serious programming error and could lead to
3005
- /// statements being unexpectedly executed or skipped.
3006
- ///
3007
- /// In debug builds (`-Onone`) a runtime error is still triggered if the
3008
- /// operation overflows.
3009
- ///
3010
- /// This method is not a synonym for the masking addition operator (`&+`).
3011
- /// Use that operator instead of this method when you want to discard any
3012
- /// overflow that results from an addition operation.
3013
- ///
3014
- /// - Parameter rhs: The value to add to this value.
3015
- /// - Returns: The sum of this value and `rhs`.
3016
- @inline ( __always)
3017
- public func unsafeAdding( _ other: Self ) -> Self {
3018
- let ( result, overflow) = self . addingReportingOverflow ( other)
3019
-
3020
- if overflow {
3021
- if ( _isDebugAssertConfiguration ( ) ) {
3022
- _preconditionFailure ( " Overflow in unsafeAdding " )
3023
- }
3024
- else {
3025
- Builtin . conditionallyUnreachable ( )
3026
- }
3027
- }
3028
- return result
3029
- }
3030
-
3031
- /// Returns the difference obtained by subtracting the given value from this
3032
- /// value without checking for arithmetic overflow.
3033
- ///
3034
- /// Use this function only to avoid the cost of overflow checking when you
3035
- /// are certain that the operation won't overflow. In optimized builds (`-O`)
3036
- /// the compiler is free to assume that overflow won't occur. Failure to
3037
- /// satisfy that assumption is a serious programming error and could lead to
3038
- /// statements being unexpectedly executed or skipped.
3039
- ///
3040
- /// In debug builds (`-Onone`) a runtime error is still triggered if the
3041
- /// operation overflows.
3042
- ///
3043
- /// This method is not a synonym for the masking subtraction operator (`&-`).
3044
- /// Use that operator instead of this method when you want to discard any
3045
- /// overflow that results from a subtraction operation.
3046
- ///
3047
- /// - Parameter rhs: The value to subtract from this value.
3048
- /// - Returns: The result of subtracting `rhs` from this value.
3049
- @inline ( __always)
3050
- public func unsafeSubtracting( _ other: Self ) -> Self {
3051
- let ( result, overflow) = self . subtractingReportingOverflow ( other)
3052
-
3053
- if overflow {
3054
- if ( _isDebugAssertConfiguration ( ) ) {
3055
- _preconditionFailure ( " Overflow in unsafeSubtracting " )
3056
- }
3057
- else {
3058
- Builtin . conditionallyUnreachable ( )
3059
- }
3060
- }
3061
- return result
3062
- }
3063
-
3064
- /// Returns the product of this value and the given value without checking
3065
- /// for arithmetic overflow.
3066
- ///
3067
- /// Use this function only to avoid the cost of overflow checking when you
3068
- /// are certain that the operation won't overflow. In optimized builds (`-O`)
3069
- /// the compiler is free to assume that overflow won't occur. Failure to
3070
- /// satisfy that assumption is a serious programming error and could lead to
3071
- /// statements being unexpectedly executed or skipped.
3072
- ///
3073
- /// In debug builds (`-Onone`) a runtime error is still triggered if the
3074
- /// operation overflows.
3075
- ///
3076
- /// This method is not a synonym for the masking multiplication operator
3077
- /// (`&*`). Use that operator instead of this method when you want to discard
3078
- /// any overflow that results from an addition operation.
3079
- ///
3080
- /// - Parameter rhs: The value to multiply by this value.
3081
- /// - Returns: The product of this value and `rhs`.
3082
- @inline ( __always)
3083
- public func unsafeMultiplied( by other: Self ) -> Self {
3084
- let ( result, overflow) = self . multipliedReportingOverflow ( by: other)
3085
-
3086
- if overflow {
3087
- if ( _isDebugAssertConfiguration ( ) ) {
3088
- _preconditionFailure ( " Overflow in unsafeMultiplied " )
3089
- }
3090
- else {
3091
- Builtin . conditionallyUnreachable ( )
3092
- }
3093
- }
3094
- return result
3095
- }
3096
-
3097
- /// Returns the quotient obtained by dividing this value by the given value
3098
- /// without checking for arithmetic overflow.
3099
- ///
3100
- /// Use this function only to avoid the cost of overflow checking when you
3101
- /// are certain that the operation won't overflow. In optimized builds (`-O`)
3102
- /// the compiler is free to assume that overflow won't occur. Failure to
3103
- /// satisfy that assumption is a serious programming error and could lead to
3104
- /// statements being unexpectedly executed or skipped.
3105
- ///
3106
- /// In debug builds (`-Onone`) a runtime error is still triggered if the
3107
- /// operation overflows.
3108
- ///
3109
- /// - Parameter rhs: The value to divide this value by.
3110
- /// - Returns: The result of dividing this value by `rhs`.
3111
- @inline ( __always)
3112
- public func unsafeDivided( by other: Self ) -> Self {
3113
- let ( result, overflow) = self . dividedReportingOverflow ( by: other)
3114
-
3115
- if overflow {
3116
- if ( _isDebugAssertConfiguration ( ) ) {
3117
- _preconditionFailure ( " Overflow in unsafeDivided " )
3118
- }
3119
- else {
3120
- Builtin . conditionallyUnreachable ( )
3121
- }
3122
- }
3123
- return result
3124
- }
3125
-
3126
2998
/// Creates a new instance from the bit pattern of the given instance by
3127
2999
/// truncating or sign-extending if needed to fit this type.
3128
3000
///
0 commit comments