Skip to content

Commit 2946c41

Browse files
author
Stjepan Glavina
committed
More consistent wording
1 parent 3fa28cc commit 2946c41

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

src/libcore/sync/atomic.rs

+25-10
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ impl AtomicBool {
296296
}
297297
}
298298

299-
/// Stores a value into the bool, returning the old value.
299+
/// Stores a value into the bool, returning the previous value.
300300
///
301301
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
302302
/// of this operation.
@@ -703,7 +703,7 @@ impl<T> AtomicPtr<T> {
703703
}
704704
}
705705

706-
/// Stores a value into the pointer, returning the old value.
706+
/// Stores a value into the pointer, returning the previous value.
707707
///
708708
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
709709
/// of this operation.
@@ -1015,7 +1015,7 @@ macro_rules! atomic_int {
10151015
unsafe { atomic_store(self.v.get(), val, order); }
10161016
}
10171017

1018-
/// Stores a value into the atomic integer, returning the old value.
1018+
/// Stores a value into the atomic integer, returning the previous value.
10191019
///
10201020
/// `swap` takes an [`Ordering`] argument which describes the memory ordering of this
10211021
/// operation.
@@ -1169,7 +1169,7 @@ macro_rules! atomic_int {
11691169
}
11701170
}
11711171

1172-
/// Add to the current value, returning the previous value.
1172+
/// Adds to the current value, returning the previous value.
11731173
///
11741174
/// This operation wraps around on overflow.
11751175
///
@@ -1188,7 +1188,7 @@ macro_rules! atomic_int {
11881188
unsafe { atomic_add(self.v.get(), val, order) }
11891189
}
11901190

1191-
/// Subtract from the current value, returning the previous value.
1191+
/// Subtracts from the current value, returning the previous value.
11921192
///
11931193
/// This operation wraps around on overflow.
11941194
///
@@ -1207,7 +1207,12 @@ macro_rules! atomic_int {
12071207
unsafe { atomic_sub(self.v.get(), val, order) }
12081208
}
12091209

1210-
/// Bitwise and with the current value, returning the previous value.
1210+
/// Bitwise "and" with the current value.
1211+
///
1212+
/// Performs a bitwise "and" operation on the current value and the argument `val`, and
1213+
/// sets the new value to the result.
1214+
///
1215+
/// Returns the previous value.
12111216
///
12121217
/// # Examples
12131218
///
@@ -1223,7 +1228,12 @@ macro_rules! atomic_int {
12231228
unsafe { atomic_and(self.v.get(), val, order) }
12241229
}
12251230

1226-
/// Bitwise or with the current value, returning the previous value.
1231+
/// Bitwise "or" with the current value.
1232+
///
1233+
/// Performs a bitwise "or" operation on the current value and the argument `val`, and
1234+
/// sets the new value to the result.
1235+
///
1236+
/// Returns the previous value.
12271237
///
12281238
/// # Examples
12291239
///
@@ -1239,7 +1249,12 @@ macro_rules! atomic_int {
12391249
unsafe { atomic_or(self.v.get(), val, order) }
12401250
}
12411251

1242-
/// Bitwise xor with the current value, returning the previous value.
1252+
/// Bitwise "xor" with the current value.
1253+
///
1254+
/// Performs a bitwise "xor" operation on the current value and the argument `val`, and
1255+
/// sets the new value to the result.
1256+
///
1257+
/// Returns the previous value.
12431258
///
12441259
/// # Examples
12451260
///
@@ -1387,7 +1402,7 @@ unsafe fn atomic_swap<T>(dst: *mut T, val: T, order: Ordering) -> T {
13871402
}
13881403
}
13891404

1390-
/// Returns the old value (like __sync_fetch_and_add).
1405+
/// Returns the previous value (like __sync_fetch_and_add).
13911406
#[inline]
13921407
unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
13931408
match order {
@@ -1400,7 +1415,7 @@ unsafe fn atomic_add<T>(dst: *mut T, val: T, order: Ordering) -> T {
14001415
}
14011416
}
14021417

1403-
/// Returns the old value (like __sync_fetch_and_sub).
1418+
/// Returns the previous value (like __sync_fetch_and_sub).
14041419
#[inline]
14051420
unsafe fn atomic_sub<T>(dst: *mut T, val: T, order: Ordering) -> T {
14061421
match order {

0 commit comments

Comments
 (0)