Skip to content

Commit 005862b

Browse files
committed
---
yaml --- r: 8151 b: refs/heads/snap-stage3 c: 50fb4c3 h: refs/heads/master i: 8149: fa75f14 8147: e78a7d5 8143: 7f7e229 v: v3
1 parent a4334d8 commit 005862b

File tree

15 files changed

+72
-70
lines changed

15 files changed

+72
-70
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 2898dcc5d97da9427ac367542382b6239d9c0bbf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 1dc5e1aa94d1c82d12385dfcb95c75cbaaa318a9
4+
refs/heads/snap-stage3: 50fb4c30ed02e72a715e093c8f87b0c179fb3ccb
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/snap-stage3/src/comp/middle/shape.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ fn mk_ctxt(llmod: ModuleRef) -> ctxt {
308308
fn add_bool(&dest: [u8], val: bool) { dest += [if val { 1u8 } else { 0u8 }]; }
309309

310310
fn add_u16(&dest: [u8], val: u16) {
311-
dest += [val & 0xffu16 as u8, val >> 8u16 as u8];
311+
dest += [(val & 0xffu16) as u8, (val >> 8u16) as u8];
312312
}
313313

314314
fn add_substr(&dest: [u8], src: [u8]) {

branches/snap-stage3/src/comp/middle/trans/base.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,8 @@ fn sanitize(s: str) -> str {
231231

232232
fn log_fn_time(ccx: @crate_ctxt, name: str, start: time::timeval,
233233
end: time::timeval) {
234-
let elapsed =
235-
1000 * (end.sec - start.sec as int) +
236-
((end.usec as int) - (start.usec as int)) / 1000;
234+
let elapsed = 1000 * ((end.sec - start.sec) as int) +
235+
((end.usec as int) - (start.usec as int)) / 1000;
237236
*ccx.stats.fn_times += [{ident: name, time: elapsed}];
238237
}
239238

branches/snap-stage3/src/comp/syntax/ast_util.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ fn eval_const_expr(e: @expr) -> const_val {
269269
mul { const_uint(a * b) } div { const_uint(a / b) }
270270
rem { const_uint(a % b) } and | bitand { const_uint(a & b) }
271271
or | bitor { const_uint(a | b) } bitxor { const_uint(a ^ b) }
272-
lsl { const_int(a << b as i64) }
273-
lsr { const_int(a >> b as i64) }
274-
asr { const_int(a >>> b as i64) }
272+
lsl { const_int((a << b) as i64) }
273+
lsr { const_int((a >> b) as i64) }
274+
asr { const_int((a >>> b) as i64) }
275275
eq { fromb(a == b) } lt { fromb(a < b) }
276276
le { fromb(a <= b) } ne { fromb(a != b) }
277277
ge { fromb(a >= b) } gt { fromb(a > b) }

branches/snap-stage3/src/comp/syntax/parse/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,7 +1123,8 @@ type op_spec = {tok: token::token, op: ast::binop, prec: int};
11231123

11241124
// FIXME make this a const, don't store it in parser state
11251125
fn prec_table() -> @[op_spec] {
1126-
ret @[{tok: token::BINOP(token::STAR), op: ast::mul, prec: 11},
1126+
ret @[// 'as' sits between here with 12
1127+
{tok: token::BINOP(token::STAR), op: ast::mul, prec: 11},
11271128
{tok: token::BINOP(token::SLASH), op: ast::div, prec: 11},
11281129
{tok: token::BINOP(token::PERCENT), op: ast::rem, prec: 11},
11291130
{tok: token::BINOP(token::PLUS), op: ast::add, prec: 10},
@@ -1134,7 +1135,6 @@ fn prec_table() -> @[op_spec] {
11341135
{tok: token::BINOP(token::AND), op: ast::bitand, prec: 8},
11351136
{tok: token::BINOP(token::CARET), op: ast::bitxor, prec: 7},
11361137
{tok: token::BINOP(token::OR), op: ast::bitor, prec: 6},
1137-
// 'as' sits between here with 5
11381138
{tok: token::LT, op: ast::lt, prec: 4},
11391139
{tok: token::LE, op: ast::le, prec: 4},
11401140
{tok: token::GE, op: ast::ge, prec: 4},
@@ -1151,7 +1151,7 @@ fn parse_binops(p: parser) -> @ast::expr {
11511151

11521152
const unop_prec: int = 100;
11531153

1154-
const as_prec: int = 5;
1154+
const as_prec: int = 12;
11551155

11561156
fn parse_more_binops(p: parser, plhs: pexpr, min_prec: int) ->
11571157
@ast::expr {

branches/snap-stage3/src/libcore/extfmt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ mod ct {
119119
if i >= lim { ret none; }
120120
let c = s[i];
121121
if !('0' as u8 <= c && c <= '9' as u8) { ret option::none; }
122-
let n = c - ('0' as u8) as uint;
122+
let n = (c - ('0' as u8)) as uint;
123123
ret alt peek_num(s, i + 1u, lim) {
124124
none { some({num: n, next: i + 1u}) }
125125
some(next) {

branches/snap-stage3/src/libcore/str.rs

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,30 @@ fn push_utf8_bytes(&s: str, ch: char) {
142142
if code < max_one_b {
143143
[code as u8]
144144
} else if code < max_two_b {
145-
[code >> 6u & 31u | tag_two_b as u8, code & 63u | tag_cont as u8]
145+
[(code >> 6u & 31u | tag_two_b) as u8,
146+
(code & 63u | tag_cont) as u8]
146147
} else if code < max_three_b {
147-
[code >> 12u & 15u | tag_three_b as u8,
148-
code >> 6u & 63u | tag_cont as u8, code & 63u | tag_cont as u8]
148+
[(code >> 12u & 15u | tag_three_b) as u8,
149+
(code >> 6u & 63u | tag_cont) as u8,
150+
(code & 63u | tag_cont) as u8]
149151
} else if code < max_four_b {
150-
[code >> 18u & 7u | tag_four_b as u8,
151-
code >> 12u & 63u | tag_cont as u8,
152-
code >> 6u & 63u | tag_cont as u8, code & 63u | tag_cont as u8]
152+
[(code >> 18u & 7u | tag_four_b) as u8,
153+
(code >> 12u & 63u | tag_cont) as u8,
154+
(code >> 6u & 63u | tag_cont) as u8,
155+
(code & 63u | tag_cont) as u8]
153156
} else if code < max_five_b {
154-
[code >> 24u & 3u | tag_five_b as u8,
155-
code >> 18u & 63u | tag_cont as u8,
156-
code >> 12u & 63u | tag_cont as u8,
157-
code >> 6u & 63u | tag_cont as u8, code & 63u | tag_cont as u8]
157+
[(code >> 24u & 3u | tag_five_b) as u8,
158+
(code >> 18u & 63u | tag_cont) as u8,
159+
(code >> 12u & 63u | tag_cont) as u8,
160+
(code >> 6u & 63u | tag_cont) as u8,
161+
(code & 63u | tag_cont) as u8]
158162
} else {
159-
[code >> 30u & 1u | tag_six_b as u8,
160-
code >> 24u & 63u | tag_cont as u8,
161-
code >> 18u & 63u | tag_cont as u8,
162-
code >> 12u & 63u | tag_cont as u8,
163-
code >> 6u & 63u | tag_cont as u8, code & 63u | tag_cont as u8]
163+
[(code >> 30u & 1u | tag_six_b) as u8,
164+
(code >> 24u & 63u | tag_cont) as u8,
165+
(code >> 18u & 63u | tag_cont) as u8,
166+
(code >> 12u & 63u | tag_cont) as u8,
167+
(code >> 6u & 63u | tag_cont) as u8,
168+
(code & 63u | tag_cont) as u8]
164169
};
165170
push_bytes(s, bytes);
166171
}
@@ -1211,13 +1216,13 @@ fn char_range_at(s: str, i: uint) -> {ch: char, next: uint} {
12111216
let byte = s[i];
12121217
assert (byte & 192u8 == tag_cont_u8);
12131218
val <<= 6u;
1214-
val += byte & 63u8 as uint;
1219+
val += (byte & 63u8) as uint;
12151220
i += 1u;
12161221
}
12171222
// Clunky way to get the right bits from the first byte. Uses two shifts,
12181223
// the first to clip off the marker bits at the left of the byte, and then
12191224
// a second (as uint) to get it to the right position.
1220-
val += (b0 << (w + 1u as u8) as uint) << ((w - 1u) * 6u - w - 1u);
1225+
val += ((b0 << ((w + 1u) as u8)) as uint) << ((w - 1u) * 6u - w - 1u);
12211226
ret {ch: val as char, next: i};
12221227
}
12231228

branches/snap-stage3/src/libstd/ebml.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ type doc = {data: @[u8], start: uint, end: uint};
1919

2020
fn vint_at(data: [u8], start: uint) -> {val: uint, next: uint} {
2121
let a = data[start];
22-
if a & 0x80u8 != 0u8 { ret {val: a & 0x7fu8 as uint, next: start + 1u}; }
22+
if a & 0x80u8 != 0u8 {
23+
ret {val: (a & 0x7fu8) as uint, next: start + 1u};
24+
}
2325
if a & 0x40u8 != 0u8 {
24-
ret {val: (a & 0x3fu8 as uint) << 8u | (data[start + 1u] as uint),
26+
ret {val: ((a & 0x3fu8) as uint) << 8u | (data[start + 1u] as uint),
2527
next: start + 2u};
2628
} else if a & 0x20u8 != 0u8 {
27-
ret {val:
28-
(a & 0x1fu8 as uint) << 16u |
29-
(data[start + 1u] as uint) << 8u |
30-
(data[start + 2u] as uint),
29+
ret {val: ((a & 0x1fu8) as uint) << 16u |
30+
(data[start + 1u] as uint) << 8u |
31+
(data[start + 2u] as uint),
3132
next: start + 3u};
3233
} else if a & 0x10u8 != 0u8 {
33-
ret {val:
34-
(a & 0x0fu8 as uint) << 24u |
35-
(data[start + 1u] as uint) << 16u |
36-
(data[start + 2u] as uint) << 8u |
37-
(data[start + 3u] as uint),
34+
ret {val: ((a & 0x0fu8) as uint) << 24u |
35+
(data[start + 1u] as uint) << 16u |
36+
(data[start + 2u] as uint) << 8u |
37+
(data[start + 3u] as uint),
3838
next: start + 4u};
3939
} else { #error("vint too big"); fail; }
4040
}
@@ -122,16 +122,14 @@ fn write_sized_vint(w: io::writer, n: uint, size: uint) {
122122
let buf: [u8];
123123
alt size {
124124
1u { buf = [0x80u8 | (n as u8)]; }
125-
2u { buf = [0x40u8 | (n >> 8u as u8), n & 0xffu as u8]; }
125+
2u { buf = [0x40u8 | ((n >> 8u) as u8), (n & 0xffu) as u8]; }
126126
3u {
127-
buf =
128-
[0x20u8 | (n >> 16u as u8), n >> 8u & 0xffu as u8,
129-
n & 0xffu as u8];
127+
buf = [0x20u8 | ((n >> 16u) as u8), (n >> 8u & 0xffu) as u8,
128+
(n & 0xffu) as u8];
130129
}
131130
4u {
132-
buf =
133-
[0x10u8 | (n >> 24u as u8), n >> 16u & 0xffu as u8,
134-
n >> 8u & 0xffu as u8, n & 0xffu as u8];
131+
buf = [0x10u8 | ((n >> 24u) as u8), (n >> 16u & 0xffu) as u8,
132+
(n >> 8u & 0xffu) as u8, (n & 0xffu) as u8];
135133
}
136134
_ { #error("vint to write too big"); fail; }
137135
}

branches/snap-stage3/src/libstd/fs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ fn basename(p: path) -> path unsafe {
7070
if i == -1 { ret p; }
7171
}
7272
let len = str::byte_len(p);
73-
if i + 1 as uint >= len { ret p; }
74-
ret str::unsafe::slice_bytes(p, i + 1 as uint, len);
73+
if (i + 1) as uint >= len { ret p; }
74+
ret str::unsafe::slice_bytes(p, (i + 1) as uint, len);
7575
}
7676

7777

branches/snap-stage3/src/libstd/io.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ impl reader_util for reader {
5959
assert (next > -1);
6060
assert (next & 192 == 128);
6161
val <<= 6u;
62-
val += next & 63 as uint;
62+
val += (next & 63) as uint;
6363
}
6464
// See str::char_at
65-
val += (b0 << (w + 1u as u8) as uint)
65+
val += ((b0 << ((w + 1u) as u8)) as uint)
6666
<< (w - 1u) * 6u - w - 1u;
6767
chars += [ val as char ];
6868
}
@@ -368,14 +368,14 @@ fn mk_file_writer(path: str, flags: [fileflag])
368368

369369
fn uint_to_le_bytes(n: uint, size: uint) -> [u8] {
370370
let bytes: [u8] = [], i = size, n = n;
371-
while i > 0u { bytes += [n & 255u as u8]; n >>= 8u; i -= 1u; }
371+
while i > 0u { bytes += [(n & 255u) as u8]; n >>= 8u; i -= 1u; }
372372
ret bytes;
373373
}
374374

375375
fn uint_to_be_bytes(n: uint, size: uint) -> [u8] {
376376
let bytes: [u8] = [];
377-
let i = size - 1u as int;
378-
while i >= 0 { bytes += [n >> (i * 8 as uint) & 255u as u8]; i -= 1; }
377+
let i = (size - 1u) as int;
378+
while i >= 0 { bytes += [(n >> ((i * 8) as uint) & 255u) as u8]; i -= 1; }
379379
ret bytes;
380380
}
381381

branches/snap-stage3/src/libstd/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ mod chained {
296296

297297
fn insert(k: K, v: V) -> bool {
298298
let nchains = vec::len(self.chains);
299-
let load = {num: self.size + 1u as int, den: nchains as int};
299+
let load = {num: (self.size + 1u) as int, den: nchains as int};
300300
// Structural consts would be nice. This is a const 3/4
301301
// load factor that we compare against.
302302
if !util::rational_leq(load, {num:3, den:4}) { rehash(self); }

branches/snap-stage3/src/libstd/sha1.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ fn mk_sha1() -> sha1 {
193193
if !st.computed { pad_msg(st); st.computed = true; }
194194
let rs: [u8] = [];
195195
for hpart: u32 in st.h {
196-
let a = hpart >> 24u32 & 0xFFu32 as u8;
197-
let b = hpart >> 16u32 & 0xFFu32 as u8;
198-
let c = hpart >> 8u32 & 0xFFu32 as u8;
199-
let d = hpart & 0xFFu32 as u8;
196+
let a = (hpart >> 24u32 & 0xFFu32) as u8;
197+
let b = (hpart >> 16u32 & 0xFFu32) as u8;
198+
let c = (hpart >> 8u32 & 0xFFu32) as u8;
199+
let d = (hpart & 0xFFu32) as u8;
200200
rs += [a, b, c, d];
201201
}
202202
ret rs;
@@ -238,14 +238,14 @@ fn mk_sha1() -> sha1 {
238238
}
239239

240240
// Store the message length as the last 8 octets
241-
st.msg_block[56] = st.len_high >> 24u32 & 0xFFu32 as u8;
242-
st.msg_block[57] = st.len_high >> 16u32 & 0xFFu32 as u8;
243-
st.msg_block[58] = st.len_high >> 8u32 & 0xFFu32 as u8;
244-
st.msg_block[59] = st.len_high & 0xFFu32 as u8;
245-
st.msg_block[60] = st.len_low >> 24u32 & 0xFFu32 as u8;
246-
st.msg_block[61] = st.len_low >> 16u32 & 0xFFu32 as u8;
247-
st.msg_block[62] = st.len_low >> 8u32 & 0xFFu32 as u8;
248-
st.msg_block[63] = st.len_low & 0xFFu32 as u8;
241+
st.msg_block[56] = (st.len_high >> 24u32 & 0xFFu32) as u8;
242+
st.msg_block[57] = (st.len_high >> 16u32 & 0xFFu32) as u8;
243+
st.msg_block[58] = (st.len_high >> 8u32 & 0xFFu32) as u8;
244+
st.msg_block[59] = (st.len_high & 0xFFu32) as u8;
245+
st.msg_block[60] = (st.len_low >> 24u32 & 0xFFu32) as u8;
246+
st.msg_block[61] = (st.len_low >> 16u32 & 0xFFu32) as u8;
247+
st.msg_block[62] = (st.len_low >> 8u32 & 0xFFu32) as u8;
248+
st.msg_block[63] = (st.len_low & 0xFFu32) as u8;
249249
process_msg_block(st);
250250
}
251251

branches/snap-stage3/src/test/bench/msgsend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn run(args: [str]) {
4848
let elapsed = end - start;
4949
std::io::stdout().write_str(#fmt("Count is %?\n", result));
5050
std::io::stdout().write_str(#fmt("Test took %? seconds\n", elapsed));
51-
let thruput = (size / workers * workers as float) / (elapsed as float);
51+
let thruput = ((size / workers * workers) as float) / (elapsed as float);
5252
std::io::stdout().write_str(#fmt("Throughput=%f per sec\n", thruput));
5353
}
5454

branches/snap-stage3/src/test/bench/shootout-binarytrees.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fn main(args: [str]) {
3838
let long_lived_tree = bottom_up_tree(0, max_depth);
3939
let depth = min_depth;
4040
while depth <= max_depth {
41-
let iterations = int::pow(2, max_depth - depth + min_depth as uint);
41+
let iterations = int::pow(2, (max_depth - depth + min_depth) as uint);
4242
let chk = 0;
4343
let i = 1;
4444
while i <= iterations {

branches/snap-stage3/src/test/run-pass/record-pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ enum t3 { c(t2, uint), }
55
fn m(in: t3) -> int {
66
alt in {
77
c({x: a(m), _}, _) { ret m; }
8-
c({x: b(m), y: y}, z) { ret (m + z as int) + y; }
8+
c({x: b(m), y: y}, z) { ret ((m + z) as int) + y; }
99
}
1010
}
1111

0 commit comments

Comments
 (0)