Changed a test to use intrinsics.rs and changed a few lines that were too long, had bad whitespace, etc.
This commit is contained in:
parent
675bdcf341
commit
9776c38731
@ -127,7 +127,8 @@ struct ArcDestruct<T> {
|
||||
}
|
||||
do task::unkillable {
|
||||
let data: ~ArcData<T> = cast::reinterpret_cast(&self.data);
|
||||
let new_count = intrinsics::atomic_xsub(&mut data.count, 1) - 1;
|
||||
let new_count =
|
||||
intrinsics::atomic_xsub(&mut data.count, 1) - 1;
|
||||
assert new_count >= 0;
|
||||
if new_count == 0 {
|
||||
// Were we really last, or should we hand off to an
|
||||
|
@ -9,8 +9,8 @@
|
||||
// except according to those terms.
|
||||
|
||||
/*!
|
||||
An attempt to move all intrinsic declarations to a single place, as mentioned in #3369
|
||||
|
||||
An attempt to move all intrinsic declarations to a single place,
|
||||
as mentioned in #3369
|
||||
The intrinsics are defined in librustc/middle/trans/foreign.rs.
|
||||
*/
|
||||
|
||||
@ -23,97 +23,97 @@ pub extern {
|
||||
pub fn atomic_xchg(dst: &mut int, src: int) -> int;
|
||||
pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
|
||||
pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
|
||||
|
||||
|
||||
pub fn atomic_xadd(dst: &mut int, src: int) -> int;
|
||||
pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
|
||||
pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
|
||||
|
||||
|
||||
pub fn atomic_xsub(dst: &mut int, src: int) -> int;
|
||||
pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
|
||||
pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
|
||||
|
||||
|
||||
pub fn size_of<T>() -> uint;
|
||||
|
||||
|
||||
pub fn move_val<T>(dst: &mut T, -src: T);
|
||||
pub fn move_val_init<T>(dst: &mut T, -src: T);
|
||||
|
||||
|
||||
pub fn min_align_of<T>() -> uint;
|
||||
pub fn pref_align_of<T>() -> uint;
|
||||
|
||||
|
||||
pub fn get_tydesc<T>() -> *();
|
||||
|
||||
|
||||
pub fn init<T>() -> T;
|
||||
|
||||
|
||||
pub fn forget<T>(_: T) -> ();
|
||||
|
||||
// FIXME: intrinsic uses legacy modes
|
||||
// XXX: intrinsic uses legacy modes
|
||||
fn reinterpret_cast<T,U>(&&src: T) -> U;
|
||||
// FIXME: intrinsic uses legacy modes
|
||||
// XXX: intrinsic uses legacy modes
|
||||
fn addr_of<T>(&&scr: T) -> *T;
|
||||
|
||||
|
||||
pub fn needs_drop<T>() -> bool;
|
||||
|
||||
// FIXME: intrinsic uses legacy modes and has reference to TyDesc
|
||||
|
||||
// XXX: intrinsic uses legacy modes and has reference to TyDesc
|
||||
// and TyVisitor which are in librustc
|
||||
//fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor) -> ();
|
||||
// FIXME: intrinsic uses legacy modes
|
||||
// XXX: intrinsic uses legacy modes
|
||||
//fn frame_address(f: &once fn(*u8));
|
||||
|
||||
|
||||
pub fn morestack_addr() -> *();
|
||||
|
||||
|
||||
pub fn memmove32(dst: *mut u8, src: *u8, size: u32);
|
||||
pub fn memmove64(dst: *mut u8, src: *u8, size: u64);
|
||||
|
||||
|
||||
pub fn sqrtf32(x: f32) -> f32;
|
||||
pub fn sqrtf64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn powif32(a: f32, x: i32) -> f32;
|
||||
pub fn powif64(a: f64, x: i32) -> f64;
|
||||
|
||||
|
||||
pub fn sinf32(x: f32) -> f32;
|
||||
pub fn sinf64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn cosf32(x: f32) -> f32;
|
||||
pub fn cosf64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn powf32(a: f32, x: f32) -> f32;
|
||||
pub fn powf64(a: f64, x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn expf32(x: f32) -> f32;
|
||||
pub fn expf64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn exp2f32(x: f32) -> f32;
|
||||
pub fn exp2f64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn logf32(x: f32) -> f32;
|
||||
pub fn logf64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn log10f32(x: f32) -> f32;
|
||||
pub fn log10f64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn log2f32(x: f32) -> f32;
|
||||
pub fn log2f64(x: f64) -> f64;
|
||||
|
||||
pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
|
||||
pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
|
||||
|
||||
|
||||
pub fn fabsf32(x: f32) -> f32;
|
||||
pub fn fabsf64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn floorf32(x: f32) -> f32;
|
||||
pub fn floorf64(x: f64) -> f64;
|
||||
|
||||
pub fn ceilf32(x: f32) -> f32;
|
||||
pub fn ceilf64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn truncf32(x: f32) -> f32;
|
||||
pub fn truncf64(x: f64) -> f64;
|
||||
|
||||
|
||||
pub fn ctpop8(x: i8) -> i8;
|
||||
pub fn ctpop16(x: i16) -> i16;
|
||||
pub fn ctpop32(x: i32) -> i32;
|
||||
pub fn ctpop64(x: i64) -> i64;
|
||||
|
||||
|
||||
pub fn ctlz8(x: i8) -> i8;
|
||||
pub fn ctlz16(x: i16) -> i16;
|
||||
pub fn ctlz32(x: i32) -> i32;
|
||||
@ -123,7 +123,7 @@ pub extern {
|
||||
pub fn cttz16(x: i16) -> i16;
|
||||
pub fn cttz32(x: i32) -> i32;
|
||||
pub fn cttz64(x: i64) -> i64;
|
||||
|
||||
|
||||
pub fn bswap16(x: i16) -> i16;
|
||||
pub fn bswap32(x: i32) -> i32;
|
||||
pub fn bswap64(x: i64) -> i64;
|
||||
|
@ -114,7 +114,8 @@ pub pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> ~[T] {
|
||||
do as_mut_buf(v) |p, _len| {
|
||||
let mut i: uint = 0u;
|
||||
while i < n_elts {
|
||||
intrinsics::move_val_init(&mut(*ptr::mut_offset(p, i)), op(i));
|
||||
intrinsics::move_val_init(&mut(*ptr::mut_offset(p, i)),
|
||||
op(i));
|
||||
i += 1u;
|
||||
}
|
||||
}
|
||||
@ -551,7 +552,7 @@ pub fn pop<T>(v: &mut ~[T]) -> T {
|
||||
}
|
||||
let valptr = ptr::to_mut_unsafe_ptr(&mut v[ln - 1u]);
|
||||
unsafe {
|
||||
// FIXME #4204: Should be intrinsics::uninit() - we don't need this zeroed
|
||||
// FIXME #4204: Should be uninit() - we don't need this zeroed
|
||||
let mut val = intrinsics::init();
|
||||
val <-> *valptr;
|
||||
raw::set_len(v, ln - 1u);
|
||||
@ -626,7 +627,7 @@ pub fn push_all_move<T>(v: &mut ~[T], mut rhs: ~[T]) {
|
||||
unsafe {
|
||||
do as_mut_buf(rhs) |p, len| {
|
||||
for uint::range(0, len) |i| {
|
||||
// FIXME #4204 Should be intrinsics::uninit() - don't need to zero
|
||||
// FIXME #4204 Should be uninit() - don't need to zero
|
||||
let mut x = intrinsics::init();
|
||||
x <-> *ptr::mut_offset(p, i);
|
||||
push(&mut *v, x);
|
||||
@ -643,7 +644,7 @@ pub fn truncate<T>(v: &mut ~[T], newlen: uint) {
|
||||
unsafe {
|
||||
// This loop is optimized out for non-drop types.
|
||||
for uint::range(newlen, oldlen) |i| {
|
||||
// FIXME #4204 Should be intrinsics::uninit() - don't need to zero
|
||||
// FIXME #4204 Should be uninit() - don't need to zero
|
||||
let mut dropped = intrinsics::init();
|
||||
dropped <-> *ptr::mut_offset(p, i);
|
||||
}
|
||||
@ -669,7 +670,7 @@ pub fn dedup<T: Eq>(v: &mut ~[T]) {
|
||||
// last_written < next_to_read < ln
|
||||
if *ptr::mut_offset(p, next_to_read) ==
|
||||
*ptr::mut_offset(p, last_written) {
|
||||
// FIXME #4204 Should be intrinsics::uninit() - don't need to
|
||||
// FIXME #4204 Should be uninit() - don't need to
|
||||
// zero
|
||||
let mut dropped = intrinsics::init();
|
||||
dropped <-> *ptr::mut_offset(p, next_to_read);
|
||||
|
@ -11,5 +11,5 @@
|
||||
pub fn main() {
|
||||
let mut x: bool = false;
|
||||
// this line breaks it
|
||||
vec::rusti::move_val_init(&mut x, false);
|
||||
private::intrinsics::move_val_init(&mut x, false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user