auto merge of #7117 : jensnockert/rust/freestanding, r=cmr

The free-standing functions in f32, f64, i8, i16, i32, i64, u8, u16,
u32, u64, float, int, and uint are replaced with generic functions in
num instead.

This means that instead of having to know everywhere what the type is, like

~~~
f64::sin(x)
~~~

You can simply write code that uses the type-generic versions in num instead, this works for all types that implement the corresponding trait in num.

~~~
num::sin(x)
~~~

Note 1: If you were previously using any of those functions, just replace them
with the corresponding function with the same name in num.

Note 2: If you were using a function that corresponds to an operator, use the
operator instead.

Note 3: This is just https://github.com/mozilla/rust/pull/7090 reopened against master.
This commit is contained in:
bors
2013-07-09 13:34:50 -07:00
41 changed files with 178 additions and 376 deletions

View File

@@ -1964,7 +1964,7 @@ pub mod raw {
/// Operations on `[u8]`
pub mod bytes {
use libc;
use uint;
use num;
use vec::raw;
use vec;
use ptr;
@@ -1988,7 +1988,7 @@ pub mod bytes {
pub fn memcmp(a: &~[u8], b: &~[u8]) -> int {
let a_len = a.len();
let b_len = b.len();
let n = uint::min(a_len, b_len) as libc::size_t;
let n = num::min(a_len, b_len) as libc::size_t;
let r = unsafe {
libc::memcmp(raw::to_ptr(*a) as *libc::c_void,
raw::to_ptr(*b) as *libc::c_void, n) as int