authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-11-19 00:44:38+11:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-11-19 00:44:38+11:00
logeb4d93ece3f9fb218a644e32823fb0052fe22653
tree18d58f22a59344a8697083339052d4645d14c7fb
parent513e8161dd3a06ecf95b7eecba3f181445c2ee0c
signaturelock-open Commit is signed but in an unrecognized format.

std: some more docs for std.atomic.Int


1 files changed, 4 insertions(+), 0 deletions(-)

lib/std/atomic/int.zig+4
......@@ -30,11 +30,13 @@ pub fn Int(comptime T: type) type {
3030 @atomicStore(T, &self.unprotected_value, value, ordering);
3131 }
3232
33 /// Twos complement wraparound increment
3334 /// Returns previous value
3435 pub fn incr(self: *Self) T {
3536 return self.rmw(.Add, 1, .SeqCst);
3637 }
3738
39 /// Twos complement wraparound decrement
3840 /// Returns previous value
3941 pub fn decr(self: *Self) T {
4042 return self.rmw(.Sub, 1, .SeqCst);
......@@ -52,6 +54,8 @@ pub fn Int(comptime T: type) type {
5254 return self.rmw(.Xchg, new_value, .SeqCst);
5355 }
5456
57 /// Twos complement wraparound add
58 /// Returns previous value
5559 pub fn fetchAdd(self: *Self, op: T) T {
5660 return self.rmw(.Add, op, .SeqCst);
5761 }