@@ -321,7 +321,7 @@ impl AtomicBool {
321
321
}
322
322
}
323
323
324
- /// Stores a value into the bool, returning the old value.
324
+ /// Stores a value into the bool, returning the previous value.
325
325
///
326
326
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
327
327
/// of this operation.
@@ -732,7 +732,7 @@ impl<T> AtomicPtr<T> {
732
732
}
733
733
}
734
734
735
- /// Stores a value into the pointer, returning the old value.
735
+ /// Stores a value into the pointer, returning the previous value.
736
736
///
737
737
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
738
738
/// of this operation.
@@ -1047,7 +1047,7 @@ macro_rules! atomic_int {
1047
1047
unsafe { atomic_store( self . v. get( ) , val, order) ; }
1048
1048
}
1049
1049
1050
- /// Stores a value into the atomic integer, returning the old value.
1050
+ /// Stores a value into the atomic integer, returning the previous value.
1051
1051
///
1052
1052
/// `swap` takes an [`Ordering`] argument which describes the memory ordering of this
1053
1053
/// operation.
@@ -1201,7 +1201,9 @@ macro_rules! atomic_int {
1201
1201
}
1202
1202
}
1203
1203
1204
- /// Add to the current value, returning the previous value.
1204
+ /// Adds to the current value, returning the previous value.
1205
+ ///
1206
+ /// This operation wraps around on overflow.
1205
1207
///
1206
1208
/// # Examples
1207
1209
///
@@ -1218,7 +1220,9 @@ macro_rules! atomic_int {
1218
1220
unsafe { atomic_add( self . v. get( ) , val, order) }
1219
1221
}
1220
1222
1221
- /// Subtract from the current value, returning the previous value.
1223
+ /// Subtracts from the current value, returning the previous value.
1224
+ ///
1225
+ /// This operation wraps around on overflow.
1222
1226
///
1223
1227
/// # Examples
1224
1228
///
@@ -1235,7 +1239,12 @@ macro_rules! atomic_int {
1235
1239
unsafe { atomic_sub( self . v. get( ) , val, order) }
1236
1240
}
1237
1241
1238
- /// Bitwise and with the current value, returning the previous value.
1242
+ /// Bitwise "and" with the current value.
1243
+ ///
1244
+ /// Performs a bitwise "and" operation on the current value and the argument `val`, and
1245
+ /// sets the new value to the result.
1246
+ ///
1247
+ /// Returns the previous value.
1239
1248
///
1240
1249
/// # Examples
1241
1250
///
@@ -1251,7 +1260,12 @@ macro_rules! atomic_int {
1251
1260
unsafe { atomic_and( self . v. get( ) , val, order) }
1252
1261
}
1253
1262
1254
- /// Bitwise or with the current value, returning the previous value.
1263
+ /// Bitwise "or" with the current value.
1264
+ ///
1265
+ /// Performs a bitwise "or" operation on the current value and the argument `val`, and
1266
+ /// sets the new value to the result.
1267
+ ///
1268
+ /// Returns the previous value.
1255
1269
///
1256
1270
/// # Examples
1257
1271
///
@@ -1267,7 +1281,12 @@ macro_rules! atomic_int {
1267
1281
unsafe { atomic_or( self . v. get( ) , val, order) }
1268
1282
}
1269
1283
1270
- /// Bitwise xor with the current value, returning the previous value.
1284
+ /// Bitwise "xor" with the current value.
1285
+ ///
1286
+ /// Performs a bitwise "xor" operation on the current value and the argument `val`, and
1287
+ /// sets the new value to the result.
1288
+ ///
1289
+ /// Returns the previous value.
1271
1290
///
1272
1291
/// # Examples
1273
1292
///
@@ -1415,7 +1434,7 @@ unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T {
1415
1434
}
1416
1435
}
1417
1436
1418
- /// Returns the old value (like __sync_fetch_and_add).
1437
+ /// Returns the previous value (like __sync_fetch_and_add).
1419
1438
#[ inline]
1420
1439
unsafe fn atomic_add < T > ( dst : * mut T , val : T , order : Ordering ) -> T {
1421
1440
match order {
@@ -1428,7 +1447,7 @@ unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
1428
1447
}
1429
1448
}
1430
1449
1431
- /// Returns the old value (like __sync_fetch_and_sub).
1450
+ /// Returns the previous value (like __sync_fetch_and_sub).
1432
1451
#[ inline]
1433
1452
unsafe fn atomic_sub < T > ( dst : * mut T , val : T , order : Ordering ) -> T {
1434
1453
match order {
0 commit comments