mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
std.atomic: load should take const pointer to Self
This commit is contained in:
parent
dfb34c3155
commit
e86a1df9f2
@ -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"),
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user