Skip to content

Commit 9776c38

Browse files
committed
Changed a test to use intrinsics.rs and changed a few lines that were too long, had bad whitespace, etc.
1 parent 675bdcf commit 9776c38

File tree

4 files changed

+43
-41
lines changed

4 files changed

+43
-41
lines changed

src/libcore/private.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ struct ArcDestruct<T> {
127127
}
128128
do task::unkillable {
129129
let data: ~ArcData<T> = cast::reinterpret_cast(&self.data);
130-
let new_count = intrinsics::atomic_xsub(&mut data.count, 1) - 1;
130+
let new_count =
131+
intrinsics::atomic_xsub(&mut data.count, 1) - 1;
131132
assert new_count >= 0;
132133
if new_count == 0 {
133134
// Were we really last, or should we hand off to an

src/libcore/private/intrinsics.rs

+34-34
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
/*!
12-
An attempt to move all intrinsic declarations to a single place, as mentioned in #3369
13-
12+
An attempt to move all intrinsic declarations to a single place,
13+
as mentioned in #3369
1414
The intrinsics are defined in librustc/middle/trans/foreign.rs.
1515
*/
1616

@@ -23,97 +23,97 @@ pub extern {
2323
pub fn atomic_xchg(dst: &mut int, src: int) -> int;
2424
pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
2525
pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
26-
26+
2727
pub fn atomic_xadd(dst: &mut int, src: int) -> int;
2828
pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
2929
pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
30-
30+
3131
pub fn atomic_xsub(dst: &mut int, src: int) -> int;
3232
pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
3333
pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
34-
34+
3535
pub fn size_of<T>() -> uint;
36-
36+
3737
pub fn move_val<T>(dst: &mut T, -src: T);
3838
pub fn move_val_init<T>(dst: &mut T, -src: T);
39-
39+
4040
pub fn min_align_of<T>() -> uint;
4141
pub fn pref_align_of<T>() -> uint;
42-
42+
4343
pub fn get_tydesc<T>() -> *();
44-
44+
4545
pub fn init<T>() -> T;
46-
46+
4747
pub fn forget<T>(_: T) -> ();
4848

49-
// FIXME: intrinsic uses legacy modes
49+
// XXX: intrinsic uses legacy modes
5050
fn reinterpret_cast<T,U>(&&src: T) -> U;
51-
// FIXME: intrinsic uses legacy modes
51+
// XXX: intrinsic uses legacy modes
5252
fn addr_of<T>(&&scr: T) -> *T;
53-
53+
5454
pub fn needs_drop<T>() -> bool;
55-
56-
// FIXME: intrinsic uses legacy modes and has reference to TyDesc
55+
56+
// XXX: intrinsic uses legacy modes and has reference to TyDesc
5757
// and TyVisitor which are in librustc
5858
//fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor) -> ();
59-
// FIXME: intrinsic uses legacy modes
59+
// XXX: intrinsic uses legacy modes
6060
//fn frame_address(f: &once fn(*u8));
61-
61+
6262
pub fn morestack_addr() -> *();
63-
63+
6464
pub fn memmove32(dst: *mut u8, src: *u8, size: u32);
6565
pub fn memmove64(dst: *mut u8, src: *u8, size: u64);
66-
66+
6767
pub fn sqrtf32(x: f32) -> f32;
6868
pub fn sqrtf64(x: f64) -> f64;
69-
69+
7070
pub fn powif32(a: f32, x: i32) -> f32;
7171
pub fn powif64(a: f64, x: i32) -> f64;
72-
72+
7373
pub fn sinf32(x: f32) -> f32;
7474
pub fn sinf64(x: f64) -> f64;
75-
75+
7676
pub fn cosf32(x: f32) -> f32;
7777
pub fn cosf64(x: f64) -> f64;
78-
78+
7979
pub fn powf32(a: f32, x: f32) -> f32;
8080
pub fn powf64(a: f64, x: f64) -> f64;
81-
81+
8282
pub fn expf32(x: f32) -> f32;
8383
pub fn expf64(x: f64) -> f64;
84-
84+
8585
pub fn exp2f32(x: f32) -> f32;
8686
pub fn exp2f64(x: f64) -> f64;
87-
87+
8888
pub fn logf32(x: f32) -> f32;
8989
pub fn logf64(x: f64) -> f64;
90-
90+
9191
pub fn log10f32(x: f32) -> f32;
9292
pub fn log10f64(x: f64) -> f64;
93-
93+
9494
pub fn log2f32(x: f32) -> f32;
9595
pub fn log2f64(x: f64) -> f64;
9696

9797
pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
9898
pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
99-
99+
100100
pub fn fabsf32(x: f32) -> f32;
101101
pub fn fabsf64(x: f64) -> f64;
102-
102+
103103
pub fn floorf32(x: f32) -> f32;
104104
pub fn floorf64(x: f64) -> f64;
105105

106106
pub fn ceilf32(x: f32) -> f32;
107107
pub fn ceilf64(x: f64) -> f64;
108-
108+
109109
pub fn truncf32(x: f32) -> f32;
110110
pub fn truncf64(x: f64) -> f64;
111-
111+
112112
pub fn ctpop8(x: i8) -> i8;
113113
pub fn ctpop16(x: i16) -> i16;
114114
pub fn ctpop32(x: i32) -> i32;
115115
pub fn ctpop64(x: i64) -> i64;
116-
116+
117117
pub fn ctlz8(x: i8) -> i8;
118118
pub fn ctlz16(x: i16) -> i16;
119119
pub fn ctlz32(x: i32) -> i32;
@@ -123,7 +123,7 @@ pub extern {
123123
pub fn cttz16(x: i16) -> i16;
124124
pub fn cttz32(x: i32) -> i32;
125125
pub fn cttz64(x: i64) -> i64;
126-
126+
127127
pub fn bswap16(x: i16) -> i16;
128128
pub fn bswap32(x: i32) -> i32;
129129
pub fn bswap64(x: i64) -> i64;

src/libcore/vec.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ pub pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> ~[T] {
114114
do as_mut_buf(v) |p, _len| {
115115
let mut i: uint = 0u;
116116
while i < n_elts {
117-
intrinsics::move_val_init(&mut(*ptr::mut_offset(p, i)), op(i));
117+
intrinsics::move_val_init(&mut(*ptr::mut_offset(p, i)),
118+
op(i));
118119
i += 1u;
119120
}
120121
}
@@ -551,7 +552,7 @@ pub fn pop<T>(v: &mut ~[T]) -> T {
551552
}
552553
let valptr = ptr::to_mut_unsafe_ptr(&mut v[ln - 1u]);
553554
unsafe {
554-
// FIXME #4204: Should be intrinsics::uninit() - we don't need this zeroed
555+
// FIXME #4204: Should be uninit() - we don't need this zeroed
555556
let mut val = intrinsics::init();
556557
val <-> *valptr;
557558
raw::set_len(v, ln - 1u);
@@ -626,7 +627,7 @@ pub fn push_all_move<T>(v: &mut ~[T], mut rhs: ~[T]) {
626627
unsafe {
627628
do as_mut_buf(rhs) |p, len| {
628629
for uint::range(0, len) |i| {
629-
// FIXME #4204 Should be intrinsics::uninit() - don't need to zero
630+
// FIXME #4204 Should be uninit() - don't need to zero
630631
let mut x = intrinsics::init();
631632
x <-> *ptr::mut_offset(p, i);
632633
push(&mut *v, x);
@@ -643,7 +644,7 @@ pub fn truncate<T>(v: &mut ~[T], newlen: uint) {
643644
unsafe {
644645
// This loop is optimized out for non-drop types.
645646
for uint::range(newlen, oldlen) |i| {
646-
// FIXME #4204 Should be intrinsics::uninit() - don't need to zero
647+
// FIXME #4204 Should be uninit() - don't need to zero
647648
let mut dropped = intrinsics::init();
648649
dropped <-> *ptr::mut_offset(p, i);
649650
}
@@ -669,7 +670,7 @@ pub fn dedup<T: Eq>(v: &mut ~[T]) {
669670
// last_written < next_to_read < ln
670671
if *ptr::mut_offset(p, next_to_read) ==
671672
*ptr::mut_offset(p, last_written) {
672-
// FIXME #4204 Should be intrinsics::uninit() - don't need to
673+
// FIXME #4204 Should be uninit() - don't need to
673674
// zero
674675
let mut dropped = intrinsics::init();
675676
dropped <-> *ptr::mut_offset(p, next_to_read);

src/test/run-pass/type-use-i1-versus-i8.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
pub fn main() {
1212
let mut x: bool = false;
1313
// this line breaks it
14-
vec::rusti::move_val_init(&mut x, false);
14+
private::intrinsics::move_val_init(&mut x, false);
1515
}

0 commit comments

Comments
 (0)