@@ -130,7 +130,7 @@ depending on the target pointer size.
130
130
131
131
macro_rules! midpoint_impl {
132
132
( $SelfT: ty, unsigned) => {
133
- /// Calculates the middle point of `self` and `rhs`.
133
+ /// Calculates the midpoint (average) between `self` and `rhs`.
134
134
///
135
135
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
136
136
/// sufficiently-large unsigned integral type. This implies that the result is
@@ -146,6 +146,8 @@ macro_rules! midpoint_impl {
146
146
#[ rustc_const_stable( feature = "num_midpoint" , since = "1.85.0" ) ]
147
147
#[ must_use = "this returns the result of the operation, \
148
148
without modifying the original"]
149
+ #[ doc( alias = "average_floor" ) ]
150
+ #[ doc( alias = "average" ) ]
149
151
#[ inline]
150
152
pub const fn midpoint( self , rhs: $SelfT) -> $SelfT {
151
153
// Use the well known branchless algorithm from Hacker's Delight to compute
@@ -154,7 +156,7 @@ macro_rules! midpoint_impl {
154
156
}
155
157
} ;
156
158
( $SelfT: ty, signed) => {
157
- /// Calculates the middle point of `self` and `rhs`.
159
+ /// Calculates the midpoint (average) between `self` and `rhs`.
158
160
///
159
161
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
160
162
/// sufficiently-large signed integral type. This implies that the result is
@@ -173,6 +175,9 @@ macro_rules! midpoint_impl {
173
175
#[ rustc_const_stable( feature = "num_midpoint_signed" , since = "1.87.0" ) ]
174
176
#[ must_use = "this returns the result of the operation, \
175
177
without modifying the original"]
178
+ #[ doc( alias = "average_floor" ) ]
179
+ #[ doc( alias = "average_ceil" ) ]
180
+ #[ doc( alias = "average" ) ]
176
181
#[ inline]
177
182
pub const fn midpoint( self , rhs: Self ) -> Self {
178
183
// Use the well known branchless algorithm from Hacker's Delight to compute
@@ -184,7 +189,7 @@ macro_rules! midpoint_impl {
184
189
}
185
190
} ;
186
191
( $SelfT: ty, $WideT: ty, unsigned) => {
187
- /// Calculates the middle point of `self` and `rhs`.
192
+ /// Calculates the midpoint (average) between `self` and `rhs`.
188
193
///
189
194
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
190
195
/// sufficiently-large unsigned integral type. This implies that the result is
@@ -200,13 +205,15 @@ macro_rules! midpoint_impl {
200
205
#[ rustc_const_stable( feature = "num_midpoint" , since = "1.85.0" ) ]
201
206
#[ must_use = "this returns the result of the operation, \
202
207
without modifying the original"]
208
+ #[ doc( alias = "average_floor" ) ]
209
+ #[ doc( alias = "average" ) ]
203
210
#[ inline]
204
211
pub const fn midpoint( self , rhs: $SelfT) -> $SelfT {
205
212
( ( self as $WideT + rhs as $WideT) / 2 ) as $SelfT
206
213
}
207
214
} ;
208
215
( $SelfT: ty, $WideT: ty, signed) => {
209
- /// Calculates the middle point of `self` and `rhs`.
216
+ /// Calculates the midpoint (average) between `self` and `rhs`.
210
217
///
211
218
/// `midpoint(a, b)` is `(a + b) / 2` as if it were performed in a
212
219
/// sufficiently-large signed integral type. This implies that the result is
@@ -225,6 +232,9 @@ macro_rules! midpoint_impl {
225
232
#[ rustc_const_stable( feature = "num_midpoint_signed" , since = "1.87.0" ) ]
226
233
#[ must_use = "this returns the result of the operation, \
227
234
without modifying the original"]
235
+ #[ doc( alias = "average_floor" ) ]
236
+ #[ doc( alias = "average_ceil" ) ]
237
+ #[ doc( alias = "average" ) ]
228
238
#[ inline]
229
239
pub const fn midpoint( self , rhs: $SelfT) -> $SelfT {
230
240
( ( self as $WideT + rhs as $WideT) / 2 ) as $SelfT
0 commit comments