Skip to content

Commit 14e179b

Browse files
committed
---
yaml --- r: 62816 b: refs/heads/snap-stage3 c: 6cc9a26 h: refs/heads/master v: v3
1 parent c16782e commit 14e179b

File tree

5 files changed

+49
-22
lines changed

5 files changed

+49
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a037fa4da3ce71d23e27d62485cc5d0f6280ed58
4+
refs/heads/snap-stage3: 6cc9a26a2d61acc0b1d707104f8c2a8b7c990012
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/base64.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub trait FromBase64 {
113113
fn from_base64(&self) -> ~[u8];
114114
}
115115

116-
impl<'self> FromBase64 for &'self [u8] {
116+
impl FromBase64 for ~[u8] {
117117
/**
118118
* Convert base64 `u8` vector into u8 byte values.
119119
* Every 4 encoded characters is converted into 3 octets, modulo padding.
@@ -188,7 +188,7 @@ impl<'self> FromBase64 for &'self [u8] {
188188
}
189189
}
190190

191-
impl<'self> FromBase64 for &'self str {
191+
impl FromBase64 for ~str {
192192
/**
193193
* Convert any base64 encoded string (literal, `@`, `&`, or `~`)
194194
* to the byte values it encodes.
@@ -227,23 +227,23 @@ mod tests {
227227

228228
#[test]
229229
fn test_to_base64() {
230-
assert_eq!("".to_base64(), ~"");
231-
assert_eq!("f".to_base64(), ~"Zg==");
232-
assert_eq!("fo".to_base64(), ~"Zm8=");
233-
assert_eq!("foo".to_base64(), ~"Zm9v");
234-
assert_eq!("foob".to_base64(), ~"Zm9vYg==");
235-
assert_eq!("fooba".to_base64(), ~"Zm9vYmE=");
236-
assert_eq!("foobar".to_base64(), ~"Zm9vYmFy");
230+
assert_eq!((~"").to_base64(), ~"");
231+
assert!((~"f").to_base64() == ~"Zg==");
232+
assert_eq!((~"fo").to_base64(), ~"Zm8=");
233+
assert_eq!((~"foo").to_base64(), ~"Zm9v");
234+
assert!((~"foob").to_base64() == ~"Zm9vYg==");
235+
assert_eq!((~"fooba").to_base64(), ~"Zm9vYmE=");
236+
assert_eq!((~"foobar").to_base64(), ~"Zm9vYmFy");
237237
}
238238
239239
#[test]
240240
fn test_from_base64() {
241-
assert_eq!("".from_base64(), str::to_bytes(""));
242-
assert_eq!("Zg==".from_base64(), str::to_bytes("f"));
243-
assert_eq!("Zm8=".from_base64(), str::to_bytes("fo"));
244-
assert_eq!("Zm9v".from_base64(), str::to_bytes("foo"));
245-
assert_eq!("Zm9vYg==".from_base64(), str::to_bytes("foob"));
246-
assert_eq!("Zm9vYmE=".from_base64(), str::to_bytes("fooba"))
247-
assert_eq!("Zm9vYmFy".from_base64(), str::to_bytes("foobar"));
241+
assert_eq!((~"").from_base64(), str::to_bytes(""));
242+
assert!((~"Zg==").from_base64() == str::to_bytes("f"));
243+
assert_eq!((~"Zm8=").from_base64(), str::to_bytes("fo"));
244+
assert_eq!((~"Zm9v").from_base64(), str::to_bytes("foo"));
245+
assert!((~"Zm9vYg==").from_base64() == str::to_bytes("foob"));
246+
assert_eq!((~"Zm9vYmE=").from_base64(), str::to_bytes("fooba"))
247+
assert_eq!((~"Zm9vYmFy").from_base64(), str::to_bytes("foobar"));
248248
}
249249
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ pub fn memzero(cx: block, llptr: ValueRef, llty: TypeRef) {
15061506
let llptr = PointerCast(cx, llptr, T_ptr(T_i8()));
15071507
let llzeroval = C_u8(0);
15081508
let size = IntCast(cx, machine::llsize_of(ccx, llty), ccx.int_type);
1509-
let align = C_i32(llalign_of_min(ccx, llty) as i32);
1509+
let align = C_i32(1i32);
15101510
let volatile = C_i1(false);
15111511
Call(cx, llintrinsicfn, [llptr, llzeroval, size, align, volatile]);
15121512
}

branches/snap-stage3/src/libstd/num/f32.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ delegate!(
8686
fn erfc(n: c_float) -> c_float = c_float_utils::erfc,
8787
fn exp_m1(n: c_float) -> c_float = c_float_utils::exp_m1,
8888
fn abs_sub(a: c_float, b: c_float) -> c_float = c_float_utils::abs_sub,
89-
fn fmax(a: c_float, b: c_float) -> c_float = c_float_utils::fmax,
90-
fn fmin(a: c_float, b: c_float) -> c_float = c_float_utils::fmin,
9189
fn next_after(x: c_float, y: c_float) -> c_float = c_float_utils::next_after,
9290
fn frexp(n: c_float, value: &mut c_int) -> c_float = c_float_utils::frexp,
9391
fn hypot(x: c_float, y: c_float) -> c_float = c_float_utils::hypot,
@@ -147,6 +145,22 @@ pub fn ge(x: f32, y: f32) -> bool { return x >= y; }
147145
#[inline(always)]
148146
pub fn gt(x: f32, y: f32) -> bool { return x > y; }
149147

148+
#[inline(always)]
149+
pub fn fmax(x: f32, y: f32) -> f32 {
150+
if x.is_NaN() { y }
151+
else if y.is_NaN() { x }
152+
else if x > y { x }
153+
else { y }
154+
}
155+
156+
#[inline(always)]
157+
pub fn fmin(x: f32, y: f32) -> f32 {
158+
if x.is_NaN() { y }
159+
else if y.is_NaN() { x }
160+
else if x < y { x }
161+
else { y }
162+
}
163+
150164

151165
// FIXME (#1999): replace the predicates below with llvm intrinsics or
152166
// calls to the libmath macros in the rust runtime for performance.

branches/snap-stage3/src/libstd/num/f64.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ delegate!(
8787
fn erfc(n: c_double) -> c_double = c_double_utils::erfc,
8888
fn exp_m1(n: c_double) -> c_double = c_double_utils::exp_m1,
8989
fn abs_sub(a: c_double, b: c_double) -> c_double = c_double_utils::abs_sub,
90-
fn fmax(a: c_double, b: c_double) -> c_double = c_double_utils::fmax,
91-
fn fmin(a: c_double, b: c_double) -> c_double = c_double_utils::fmin,
9290
fn next_after(x: c_double, y: c_double) -> c_double = c_double_utils::next_after,
9391
fn frexp(n: c_double, value: &mut c_int) -> c_double = c_double_utils::frexp,
9492
fn hypot(x: c_double, y: c_double) -> c_double = c_double_utils::hypot,
@@ -172,6 +170,21 @@ pub fn ge(x: f64, y: f64) -> bool { return x >= y; }
172170
#[inline(always)]
173171
pub fn gt(x: f64, y: f64) -> bool { return x > y; }
174172

173+
#[inline(always)]
174+
pub fn fmax(x: f64, y: f64) -> f64 {
175+
if x.is_NaN() { y }
176+
else if y.is_NaN() { x }
177+
else if x > y { x }
178+
else { y }
179+
}
180+
181+
#[inline(always)]
182+
pub fn fmin(x: f64, y: f64) -> f64 {
183+
if x.is_NaN() { y }
184+
else if y.is_NaN() { x }
185+
else if x < y { x }
186+
else { y }
187+
}
175188

176189
// FIXME (#1999): add is_normal, is_subnormal, and fpclassify
177190

0 commit comments

Comments
 (0)