diff options
| author | Hadron67 <604700341@qq.com> | 2021-04-18 15:47:27 +0800 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2021-04-23 22:39:49 +0200 |
| commit | e86a1df9f23386cc315ac8055ecfe7a6465c5ee3 (patch) | |
| tree | acb74268bb2a9dc1782f33c9a081e24764277548 /lib/std | |
| parent | dfb34c315576525806a471ae0c4f94b76d362bf9 (diff) | |
| download | zig-e86a1df9f23386cc315ac8055ecfe7a6465c5ee3.tar.gz zig-e86a1df9f23386cc315ac8055ecfe7a6465c5ee3.zip | |
std.atomic: load should take const pointer to Self
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/atomic/bool.zig | 2 | ||||
| -rw-r--r-- | lib/std/atomic/int.zig | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/atomic/bool.zig b/lib/std/atomic/bool.zig index c968b862b9..0cffb99d38 100644 --- a/lib/std/atomic/bool.zig +++ b/lib/std/atomic/bool.zig @@ -28,7 +28,7 @@ pub const Bool = extern struct { return @atomicRmw(bool, &self.unprotected_value, .Xchg, operand, ordering); } - pub fn load(self: *Self, comptime ordering: std.builtin.AtomicOrder) bool { + pub fn load(self: *const Self, comptime ordering: std.builtin.AtomicOrder) bool { switch (ordering) { .Unordered, .Monotonic, .Acquire, .SeqCst => {}, else => @compileError("Invalid ordering '" ++ @tagName(ordering) ++ "' for a load operation"), diff --git a/lib/std/atomic/int.zig b/lib/std/atomic/int.zig index 1a3bead2df..2d1c5f80e9 100644 --- a/lib/std/atomic/int.zig +++ b/lib/std/atomic/int.zig @@ -31,7 +31,7 @@ pub fn Int(comptime T: type) type { return @atomicRmw(T, &self.unprotected_value, op, operand, ordering); } - pub fn load(self: *Self, comptime ordering: builtin.AtomicOrder) T { + pub fn load(self: *const Self, comptime ordering: builtin.AtomicOrder) T { switch (ordering) { .Unordered, .Monotonic, .Acquire, .SeqCst => {}, else => @compileError("Invalid ordering '" ++ @tagName(ordering) ++ "' for a load operation"), @@ -59,7 +59,7 @@ pub fn Int(comptime T: type) type { return self.rmw(.Sub, 1, .SeqCst); } - pub fn get(self: *Self) T { + pub fn get(self: *const Self) T { return self.load(.SeqCst); } |
