commit fac2a2e7545db8d814baf2f011acee24bf9f95ee (tree)
parent 5b283fba77d50b48d9b9895fac36ee3e1844bd1c
Author: Koakuma <koachan@protonmail.com>
Date: Fri, 15 Apr 2022 19:44:46 +0700
compiler_rt: atomics: Formatting change for flag definition
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/std/special/compiler_rt/atomics.zig b/lib/std/special/compiler_rt/atomics.zig
@@ -54,14 +54,15 @@ const SpinlockTable = struct {
fn acquire(self: *@This()) void {
while (true) {
- const flag = if (comptime arch.isSPARC())
- asm volatile ("ldstub [%[addr]], %[flag]"
+ const flag = if (comptime arch.isSPARC()) flag: {
+ break :flag asm volatile ("ldstub [%[addr]], %[flag]"
: [flag] "=r" (-> @TypeOf(self.v)),
: [addr] "r" (&self.v),
: "memory"
- )
- else
- @atomicRmw(@TypeOf(self.v), &self.v, .Xchg, .Locked, .Acquire);
+ );
+ } else flag: {
+ break :flag @atomicRmw(@TypeOf(self.v), &self.v, .Xchg, .Locked, .Acquire);
+ };
switch (flag) {
.Unlocked => break,