Skip to content

Commit

Permalink
auto merge of #18367 : pcwalton/rust/inline-atomic-constructors, r=th…
Browse files Browse the repository at this point in the history
…estinger

Servo really wants this.

r? @brson
  • Loading branch information
bors committed Oct 30, 2014
2 parents c40fc79 + aa242e7 commit ad4557c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libcore/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const UINT_TRUE: uint = -1;
#[stable]
impl AtomicBool {
/// Create a new `AtomicBool`
#[inline]
pub fn new(v: bool) -> AtomicBool {
let val = if v { UINT_TRUE } else { 0 };
AtomicBool { v: UnsafeCell::new(val), nocopy: marker::NoCopy }
Expand Down Expand Up @@ -305,6 +306,7 @@ impl AtomicBool {
#[stable]
impl AtomicInt {
/// Create a new `AtomicInt`
#[inline]
pub fn new(v: int) -> AtomicInt {
AtomicInt {v: UnsafeCell::new(v), nocopy: marker::NoCopy}
}
Expand Down Expand Up @@ -426,6 +428,7 @@ impl AtomicInt {
#[stable]
impl AtomicUint {
/// Create a new `AtomicUint`
#[inline]
pub fn new(v: uint) -> AtomicUint {
AtomicUint { v: UnsafeCell::new(v), nocopy: marker::NoCopy }
}
Expand Down Expand Up @@ -547,6 +550,7 @@ impl AtomicUint {
#[stable]
impl<T> AtomicPtr<T> {
/// Create a new `AtomicPtr`
#[inline]
pub fn new(p: *mut T) -> AtomicPtr<T> {
AtomicPtr { p: UnsafeCell::new(p as uint), nocopy: marker::NoCopy }
}
Expand Down

0 comments on commit ad4557c

Please sign in to comment.