Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fetch_and, fetch_or, fetch_nand, fetch_xor to AtomicInt, AtomicUint #12949

Closed
brson opened this issue Mar 16, 2014 · 1 comment
Closed

Add fetch_and, fetch_or, fetch_nand, fetch_xor to AtomicInt, AtomicUint #12949

brson opened this issue Mar 16, 2014 · 1 comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@brson
Copy link
Contributor

brson commented Mar 16, 2014

I don't see any reason these shouldn't exist.

@alexcrichton
Copy link
Member

cc #8151 and #10154

It appears that we removed these originally because they were lowered to intrinsic calls on arm. Now that we're linking to compiler-rt, though (and passing v7 by default on arm), this is probably fine.

@bors bors closed this as completed in 7056f97 Apr 4, 2014
jonhoo added a commit to jonhoo/rust that referenced this issue Apr 10, 2020
This adds various `fetch_` methods to `AtomicPtr` that are present on
other `Atomic*` types. It does so such that libraries that depend on
atomic operations on pointers do not have to cast those pointers to
`usize` and fiddle around with `AtomicUsize` instead.

Note that this patch currently implements `fetch_add` and `fetch_sub`
without considering the size of the pointer target. This is unlike
regular pointer additions and subtractions. The rationale for this is
that for atomic operations, the user may indeed wish to truly increment
by 1, which is difficult if all deltas are interpreted in increments of
the type's size.

This patch effectively resurrects the change from rust-lang#10154. Based on
rust-lang#12949 (comment),
the rationale for not making the changes at the time no longer hold.
lnicola pushed a commit to lnicola/rust that referenced this issue Aug 9, 2022
fix: Fix incorrect token pick rankings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants