Skip to content

Remove most free-standing numeric functions and implement Interpolate trait #6986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
4 changes: 2 additions & 2 deletions src/libextra/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl Arena {
fn alloc_pod_grow(&mut self, n_bytes: uint, align: uint) -> *u8 {
// Allocate a new chunk.
let chunk_size = at_vec::capacity(self.pod_head.data);
let new_min_chunk_size = uint::max(n_bytes, chunk_size);
let new_min_chunk_size = n_bytes.max(&chunk_size);
self.chunks = @mut MutCons(copy self.pod_head, self.chunks);
self.pod_head =
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), true);
Expand Down Expand Up @@ -215,7 +215,7 @@ impl Arena {
-> (*u8, *u8) {
// Allocate a new chunk.
let chunk_size = at_vec::capacity(self.head.data);
let new_min_chunk_size = uint::max(n_bytes, chunk_size);
let new_min_chunk_size = n_bytes.max(&chunk_size);
self.chunks = @mut MutCons(copy self.head, self.chunks);
self.head =
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), false);
Expand Down
7 changes: 3 additions & 4 deletions src/libextra/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ impl Set<uint> for BitvSet {
}
let nbits = self.capacity();
if value >= nbits {
let newsize = uint::max(value, nbits * 2) / uint::bits + 1;
let newsize = value.max(&(nbits * 2)) / uint::bits + 1;
assert!(newsize > self.bitv.storage.len());
self.bitv.storage.grow(newsize, &0);
}
Expand Down Expand Up @@ -824,8 +824,7 @@ impl BitvSet {
/// and w1/w2 are the words coming from the two vectors self, other.
fn each_common(&self, other: &BitvSet,
f: &fn(uint, uint, uint) -> bool) -> bool {
let min = uint::min(self.bitv.storage.len(),
other.bitv.storage.len());
let min = self.bitv.storage.len().min(&other.bitv.storage.len());
self.bitv.storage.slice(0, min).eachi(|i, &w| {
f(i * uint::bits, w, other.bitv.storage[i])
})
Expand All @@ -842,7 +841,7 @@ impl BitvSet {
f: &fn(bool, uint, uint) -> bool) -> bool {
let len1 = self.bitv.storage.len();
let len2 = other.bitv.storage.len();
let min = uint::min(len1, len2);
let min = len1.min(&len2);

/* only one of these loops will execute and that's the point */
for self.bitv.storage.slice(min, len1).eachi |i, &w| {
Expand Down
3 changes: 1 addition & 2 deletions src/libextra/net_tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use core::comm::{stream, Port, SharedChan};
use core::ptr;
use core::result::{Result};
use core::result;
use core::uint;
use core::vec;

pub mod rustrt {
Expand Down Expand Up @@ -884,7 +883,7 @@ impl io::Reader for TcpSocketBuf {
let needed = len - count;
if nbuffered > 0 {
unsafe {
let ncopy = uint::min(nbuffered, needed);
let ncopy = nbuffered.min(&needed);
let dst = ptr::mut_offset(
vec::raw::to_mut_ptr(buf), count);
let src = ptr::offset(
Expand Down
Loading