-
-
Notifications
You must be signed in to change notification settings - Fork 17
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 add/sub/and/or/xor methods that do not return previous value #47
Conversation
Look great to me. @YuhanLiin, if this works for you, I'll release |
@@ -2539,6 +2779,55 @@ assert_eq!(foo.load(Ordering::SeqCst), 10); | |||
} | |||
} | |||
|
|||
doc_comment! { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use triple slashes for this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to stringify a macro metavariable using stringify!
, we need to use the #[doc]
attribute and string literal instead of the usual doc comment. In recent compilers (1.54+), #[doc = concat!(...)]
also works, but in older compilers, a macro like this needs to be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense
Yeah everything looks good to me. |
Thanks both of you for the review! bors r+ |
47: Add add/sub/and/or/xor methods that do not return previous value r=taiki-e a=taiki-e This adds `Atomic{I,U}*::{add,sub,and,or,xor}` and `AtomicBool::{and,or,xor}` methods. They are equivalent to the corresponding `fetch_*` methods, but do not return the previous value. They are intended for optimization on platforms that implement atomics using inline assembly, such as the MSP430. Currently, optimizations by these methods (add,sub,and,or,xor) are only guaranteed for MSP430; on x86, LLVM can optimize in most cases, so cases, where this would improve things, should be rare. See pftbest/msp430-atomic#7 for the context. cc `@cr1901` `@YuhanLiin` Co-authored-by: Taiki Endo <[email protected]>
Timed out. |
bors retry |
Published in 0.3.16. |
This adds
Atomic{I,U}*::{add,sub,and,or,xor}
andAtomicBool::{and,or,xor}
methods.They are equivalent to the corresponding
fetch_*
methods, but do not return the previous value. They are intended for optimization on platforms that implement atomics using inline assembly, such as the MSP430.Currently, optimizations by these methods (add,sub,and,or,xor) are only guaranteed for MSP430; on x86, LLVM can optimize in most cases, so cases, where this would improve things, should be rare.
See pftbest/msp430-atomic#7 for the context.
cc @cr1901 @YuhanLiin