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 {...@@ -28,7 +28,7 @@ pub const Bool = extern struct {
28 return @atomicRmw(bool, &self.unprotected_value, .Xchg, operand, ordering);28 return @atomicRmw(bool, &self.unprotected_value, .Xchg, operand, ordering);
29 }29 }
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 {
32 switch (ordering) {32 switch (ordering) {
33 .Unordered, .Monotonic, .Acquire, .SeqCst => {},33 .Unordered, .Monotonic, .Acquire, .SeqCst => {},
34 else => @compileError("Invalid ordering '" ++ @tagName(ordering) ++ "' for a load operation"),34 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 {...@@ -31,7 +31,7 @@ pub fn Int(comptime T: type) type {
31 return @atomicRmw(T, &self.unprotected_value, op, operand, ordering);31 return @atomicRmw(T, &self.unprotected_value, op, operand, ordering);
32 }32 }
3333
34 pub fn load(self: *Self, comptime ordering: builtin.AtomicOrder) T {34 pub fn load(self: *const Self, comptime ordering: builtin.AtomicOrder) T {
35 switch (ordering) {35 switch (ordering) {
36 .Unordered, .Monotonic, .Acquire, .SeqCst => {},36 .Unordered, .Monotonic, .Acquire, .SeqCst => {},
37 else => @compileError("Invalid ordering '" ++ @tagName(ordering) ++ "' for a load operation"),37 else => @compileError("Invalid ordering '" ++ @tagName(ordering) ++ "' for a load operation"),
...@@ -59,7 +59,7 @@ pub fn Int(comptime T: type) type {...@@ -59,7 +59,7 @@ pub fn Int(comptime T: type) type {
59 return self.rmw(.Sub, 1, .SeqCst);59 return self.rmw(.Sub, 1, .SeqCst);
60 }60 }
6161
62 pub fn get(self: *Self) T {62 pub fn get(self: *const Self) T {
63 return self.load(.SeqCst);63 return self.load(.SeqCst);
64 }64 }
6565