Finish de-exporting uint modules. Part of #3583.

This commit is contained in:
Graydon Hoare 2012-09-28 14:54:25 -07:00
parent 2f4ee89119
commit 94f7bf98f9
7 changed files with 19 additions and 52 deletions

View File

@ -120,62 +120,43 @@ mod i64 {
}
/// Operations and constants for `uint`
#[legacy_exports]
#[path = "uint-template"]
mod uint {
#[legacy_exports];
use inst::{
pub use inst::{
div_ceil, div_round, div_floor, iterate,
next_power_of_two
};
export div_ceil, div_round, div_floor, iterate,
next_power_of_two;
#[path = "uint.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `u8`
#[legacy_exports]
#[path = "uint-template"]
mod u8 {
#[legacy_exports];
use inst::is_ascii;
export is_ascii;
pub use inst::is_ascii;
#[path = "u8.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `u16`
#[legacy_exports]
#[path = "uint-template"]
mod u16 {
#[legacy_exports];
#[path = "u16.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `u32`
#[legacy_exports]
#[path = "uint-template"]
mod u32 {
#[legacy_exports];
#[path = "u32.rs"]
#[legacy_exports]
mod inst;
}
/// Operations and constants for `u64`
#[legacy_exports]
#[path = "uint-template"]
mod u64 {
#[legacy_exports];
#[path = "u64.rs"]
#[legacy_exports]
mod inst;
}

View File

@ -6,20 +6,6 @@ use T = inst::T;
use cmp::{Eq, Ord};
use from_str::FromStr;
export min_value, max_value;
export min, max;
export add, sub, mul, div, rem;
export lt, le, eq, ne, ge, gt;
export is_positive, is_negative;
export is_nonpositive, is_nonnegative;
export range;
export compl;
export to_str, to_str_bytes;
export from_str, from_str_radix, str, parse_bytes;
export num, ord, eq, times, timesi;
export bits, bytes;
export str;
pub const bits : uint = inst::bits;
pub const bytes : uint = (inst::bits / 8);

View File

@ -1,2 +1,2 @@
type T = u16;
const bits: uint = 16;
pub type T = u16;
pub const bits: uint = 16;

View File

@ -1,2 +1,2 @@
type T = u32;
const bits: uint = 32;
pub type T = u32;
pub const bits: uint = 32;

View File

@ -1,2 +1,2 @@
type T = u64;
const bits: uint = 64;
pub type T = u64;
pub const bits: uint = 64;

View File

@ -1,7 +1,7 @@
type T = u8;
const bits: uint = 8;
pub type T = u8;
pub const bits: uint = 8;
// Type-specific functions here. These must be reexported by the
// parent module so that they appear in core::u8 and not core::u8::u8;
pure fn is_ascii(x: T) -> bool { return 0 as T == x & 128 as T; }
pub pure fn is_ascii(x: T) -> bool { return 0 as T == x & 128 as T; }

View File

@ -1,11 +1,11 @@
type T = uint;
pub type T = uint;
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "arm")]
const bits: uint = 32;
pub const bits: uint = 32;
#[cfg(target_arch = "x86_64")]
const bits: uint = 64;
pub const bits: uint = 64;
/**
* Divide two numbers, return the result, rounded up.
@ -19,7 +19,7 @@ const bits: uint = 64;
*
* The smallest integer `q` such that `x/y <= q`.
*/
pure fn div_ceil(x: uint, y: uint) -> uint {
pub pure fn div_ceil(x: uint, y: uint) -> uint {
let div = x / y;
if x % y == 0u { div }
else { div + 1u }
@ -37,7 +37,7 @@ pure fn div_ceil(x: uint, y: uint) -> uint {
*
* The integer `q` closest to `x/y`.
*/
pure fn div_round(x: uint, y: uint) -> uint {
pub pure fn div_round(x: uint, y: uint) -> uint {
let div = x / y;
if x % y * 2u < y { div }
else { div + 1u }
@ -58,7 +58,7 @@ pure fn div_round(x: uint, y: uint) -> uint {
* The smallest integer `q` such that `x/y <= q`. This
* is either `x/y` or `x/y + 1`.
*/
pure fn div_floor(x: uint, y: uint) -> uint { return x / y; }
pub pure fn div_floor(x: uint, y: uint) -> uint { return x / y; }
/**
* Iterate over the range [`lo`..`hi`), or stop when requested
@ -75,7 +75,7 @@ pure fn div_floor(x: uint, y: uint) -> uint { return x / y; }
* `true` If execution proceeded correctly, `false` if it was interrupted,
* that is if `it` returned `false` at any point.
*/
pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
pub pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
let mut i = lo;
while i < hi {
if (!it(i)) { return false; }
@ -86,7 +86,7 @@ pure fn iterate(lo: uint, hi: uint, it: fn(uint) -> bool) -> bool {
/// Returns the smallest power of 2 greater than or equal to `n`
#[inline(always)]
fn next_power_of_two(n: uint) -> uint {
pub fn next_power_of_two(n: uint) -> uint {
let halfbits: uint = sys::size_of::<uint>() * 4u;
let mut tmp: uint = n - 1u;
let mut shift: uint = 1u;