Skip to content

Commit

Permalink
rustc_data_structures: sync and atomic consistency
Browse files Browse the repository at this point in the history
Co-authored-by: @lukas-code
  • Loading branch information
notriddle committed May 25, 2023
1 parent 64cfc21 commit 52bd82f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions compiler/rustc_data_structures/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,14 @@ cfg_if! {

impl Atomic<bool> {
pub fn fetch_or(&self, val: bool, _: Ordering) -> bool {
let result = self.0.get() | val;
self.0.set(val);
result
let old = self.0.get();
self.0.set(val | old);
old
}
pub fn fetch_and(&self, val: bool, _: Ordering) -> bool {
let result = self.0.get() & val;
self.0.set(val);
result
let old = self.0.get();
self.0.set(val & old);
old
}
}

Expand Down

0 comments on commit 52bd82f

Please sign in to comment.