authorgravatar for 604700341@qq.comHadron67 <604700341@qq.com> 2021-04-18 15:47:27+08:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-04-23 22:39:49+02:00
loge86a1df9f23386cc315ac8055ecfe7a6465c5ee3
treeacb74268bb2a9dc1782f33c9a081e24764277548
parentdfb34c315576525806a471ae0c4f94b76d362bf9

std.atomic: load should take const pointer to Self


2 files changed, 3 insertions(+), 3 deletions(-)

lib/std/atomic/bool.zig+1-1
......@@ -28,7 +28,7 @@ pub const Bool = extern struct {
2828 return @atomicRmw(bool, &self.unprotected_value, .Xchg, operand, ordering);
2929 }
3030
31 pub fn load(self: *Self, comptime ordering: std.builtin.AtomicOrder) bool {
31 pub fn load(self: *const Self, comptime ordering: std.builtin.AtomicOrder) bool {
3232 switch (ordering) {
3333 .Unordered, .Monotonic, .Acquire, .SeqCst => {},
3434 else => @compileError("Invalid ordering '" ++ @tagName(ordering) ++ "' for a load operation"),
lib/std/atomic/int.zig+2-2
......@@ -31,7 +31,7 @@ pub fn Int(comptime T: type) type {
3131 return @atomicRmw(T, &self.unprotected_value, op, operand, ordering);
3232 }
3333
34 pub fn load(self: *Self, comptime ordering: builtin.AtomicOrder) T {
34 pub fn load(self: *const Self, comptime ordering: builtin.AtomicOrder) T {
3535 switch (ordering) {
3636 .Unordered, .Monotonic, .Acquire, .SeqCst => {},
3737 else => @compileError("Invalid ordering '" ++ @tagName(ordering) ++ "' for a load operation"),
......@@ -59,7 +59,7 @@ pub fn Int(comptime T: type) type {
5959 return self.rmw(.Sub, 1, .SeqCst);
6060 }
6161
62 pub fn get(self: *Self) T {
62 pub fn get(self: *const Self) T {
6363 return self.load(.SeqCst);
6464 }
6565