Skip to content

Commit

Permalink
Move std::num::Integer to libnum
Browse files Browse the repository at this point in the history
  • Loading branch information
brendanzab committed Feb 21, 2014
1 parent 2fa7d6b commit 3a9eca3
Show file tree
Hide file tree
Showing 12 changed files with 439 additions and 421 deletions.
2 changes: 1 addition & 1 deletion src/etc/vim/syntax/rust.vim
Expand Up @@ -85,7 +85,7 @@ syn keyword rustTrait Iterator DoubleEndedIterator RandomAccessIterator Cloneabl
syn keyword rustTrait OrdIterator MutableDoubleEndedIterator ExactSize

syn keyword rustTrait Algebraic Trigonometric Exponential Hyperbolic
syn keyword rustTrait Bitwise Bounded Integer
syn keyword rustTrait Bitwise Bounded Fractional
syn keyword rustTrait Num NumCast CheckedAdd CheckedSub CheckedMul CheckedDiv
syn keyword rustTrait Orderable Signed Unsigned Round
syn keyword rustTrait Primitive Int Float ToStrRadix ToPrimitive FromPrimitive
Expand Down
8 changes: 6 additions & 2 deletions src/libnum/bigint.rs
Expand Up @@ -16,6 +16,8 @@ A `BigUint` is represented as an array of `BigDigit`s.
A `BigInt` is a combination of `BigUint` and `Sign`.
*/

use Integer;

use std::cmp;
use std::cmp::{Eq, Ord, TotalEq, TotalOrd, Ordering, Less, Equal, Greater};
use std::num::{Zero, One, ToStrRadix, FromStrRadix};
Expand Down Expand Up @@ -461,7 +463,7 @@ impl Integer for BigUint {

/// Returns `true` if the number can be divided by `other` without leaving a remainder
#[inline]
fn is_multiple_of(&self, other: &BigUint) -> bool { (*self % *other).is_zero() }
fn divides(&self, other: &BigUint) -> bool { (*self % *other).is_zero() }

/// Returns `true` if the number is divisible by `2`
#[inline]
Expand Down Expand Up @@ -1118,7 +1120,7 @@ impl Integer for BigInt {

/// Returns `true` if the number can be divided by `other` without leaving a remainder
#[inline]
fn is_multiple_of(&self, other: &BigInt) -> bool { self.data.is_multiple_of(&other.data) }
fn divides(&self, other: &BigInt) -> bool { self.data.divides(&other.data) }

/// Returns `true` if the number is divisible by `2`
#[inline]
Expand Down Expand Up @@ -1388,6 +1390,7 @@ impl BigInt {
#[cfg(test)]
mod biguint_tests {
use Integer;
use super::{BigDigit, BigUint, ToBigUint};
use super::{Plus, BigInt, RandBigInt, ToBigInt};
Expand Down Expand Up @@ -2045,6 +2048,7 @@ mod biguint_tests {

#[cfg(test)]
mod bigint_tests {
use Integer;
use super::{BigDigit, BigUint, ToBigUint};
use super::{Sign, Minus, Zero, Plus, BigInt, RandBigInt, ToBigInt};

Expand Down

5 comments on commit 3a9eca3

@bors
Copy link
Contributor

@bors bors commented on 3a9eca3 Feb 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at brendanzab@3a9eca3

@bors
Copy link
Contributor

@bors bors commented on 3a9eca3 Feb 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging bjz/rust/integer = 3a9eca3 into auto

@bors
Copy link
Contributor

@bors bors commented on 3a9eca3 Feb 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bjz/rust/integer = 3a9eca3 merged ok, testing candidate = b5995b4

@bors
Copy link
Contributor

@bors bors commented on 3a9eca3 Feb 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 3a9eca3 Feb 21, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = b5995b4

Please sign in to comment.