| ... | ... | @@ -30,11 +30,13 @@ pub fn Int(comptime T: type) type { |
| 30 | 30 | @atomicStore(T, &self.unprotected_value, value, ordering); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | /// Twos complement wraparound increment |
| 33 | 34 | /// Returns previous value |
| 34 | 35 | pub fn incr(self: *Self) T { |
| 35 | 36 | return self.rmw(.Add, 1, .SeqCst); |
| 36 | 37 | } |
| 37 | 38 | |
| 39 | /// Twos complement wraparound decrement |
| 38 | 40 | /// Returns previous value |
| 39 | 41 | pub fn decr(self: *Self) T { |
| 40 | 42 | return self.rmw(.Sub, 1, .SeqCst); |
| ... | ... | @@ -52,6 +54,8 @@ pub fn Int(comptime T: type) type { |
| 52 | 54 | return self.rmw(.Xchg, new_value, .SeqCst); |
| 53 | 55 | } |
| 54 | 56 | |
| 57 | /// Twos complement wraparound add |
| 58 | /// Returns previous value |
| 55 | 59 | pub fn fetchAdd(self: *Self, op: T) T { |
| 56 | 60 | return self.rmw(.Add, op, .SeqCst); |
| 57 | 61 | } |