Skip to content

Commit 17f8551

Browse files
author
James Miller
committed
---
yaml --- r: 56632 b: refs/heads/auto c: 1bd3184 h: refs/heads/master v: v3
1 parent cb38dcf commit 17f8551

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: b4bdc3f50040301bdcd372e320044f8fb2efb76f
17+
refs/heads/auto: 1bd318421e4fb4252074f2963ab77dddec7949ac
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libstd/num/bigint.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ A big unsigned integer type.
8080
A BigUint-typed value BigUint { data: @[a, b, c] } represents a number
8181
(a + b * BigDigit::base + c * BigDigit::base^2).
8282
*/
83-
#[deriving(Clone)]
8483
pub struct BigUint {
8584
priv data: ~[BigDigit]
8685
}
@@ -681,7 +680,7 @@ priv fn get_radix_base(radix: uint) -> (uint, uint) {
681680
}
682681

683682
/// A Sign is a BigInt's composing element.
684-
#[deriving(Eq, Clone)]
683+
#[deriving(Eq)]
685684
pub enum Sign { Minus, Zero, Plus }
686685

687686
impl Ord for Sign {
@@ -727,7 +726,6 @@ impl Neg<Sign> for Sign {
727726
}
728727

729728
/// A big signed integer type.
730-
#[deriving(Clone)]
731729
pub struct BigInt {
732730
priv sign: Sign,
733731
priv data: BigUint
@@ -827,8 +825,8 @@ impl Signed for BigInt {
827825
#[inline(always)]
828826
fn abs(&self) -> BigInt {
829827
match self.sign {
830-
Plus | Zero => self.clone(),
831-
Minus => BigInt::from_biguint(Plus, self.data.clone())
828+
Plus | Zero => copy *self,
829+
Minus => BigInt::from_biguint(Plus, copy self.data)
832830
}
833831
}
834832

@@ -852,8 +850,8 @@ impl Add<BigInt, BigInt> for BigInt {
852850
#[inline(always)]
853851
fn add(&self, other: &BigInt) -> BigInt {
854852
match (self.sign, other.sign) {
855-
(Zero, _) => other.clone(),
856-
(_, Zero) => self.clone(),
853+
(Zero, _) => copy *other,
854+
(_, Zero) => copy *self,
857855
(Plus, Plus) => BigInt::from_biguint(Plus,
858856
self.data + other.data),
859857
(Plus, Minus) => self - (-*other),
@@ -868,7 +866,7 @@ impl Sub<BigInt, BigInt> for BigInt {
868866
fn sub(&self, other: &BigInt) -> BigInt {
869867
match (self.sign, other.sign) {
870868
(Zero, _) => -other,
871-
(_, Zero) => self.clone(),
869+
(_, Zero) => copy *self,
872870
(Plus, Plus) => match self.data.cmp(&other.data) {
873871
Less => BigInt::from_biguint(Minus, other.data - self.data),
874872
Greater => BigInt::from_biguint(Plus, self.data - other.data),
@@ -915,7 +913,7 @@ impl Rem<BigInt, BigInt> for BigInt {
915913
impl Neg<BigInt> for BigInt {
916914
#[inline(always)]
917915
fn neg(&self) -> BigInt {
918-
BigInt::from_biguint(self.sign.neg(), self.data.clone())
916+
BigInt::from_biguint(self.sign.neg(), copy self.data)
919917
}
920918
}
921919

@@ -1102,9 +1100,9 @@ pub impl BigInt {
11021100
11031101
#[cfg(test)]
11041102
mod biguint_tests {
1105-
use super::*;
11061103
use core::num::{IntConvertible, Zero, One, FromStrRadix};
11071104
use core::cmp::{Less, Equal, Greater};
1105+
use super::{BigUint, BigDigit};
11081106
11091107
#[test]
11101108
fn test_from_slice() {
@@ -1392,10 +1390,10 @@ mod biguint_tests {
13921390
let c = BigUint::from_slice(cVec);
13931391

13941392
if !a.is_zero() {
1395-
assert!(c.div_rem(&a) == (b.clone(), Zero::zero()));
1393+
assert!(c.div_rem(&a) == (copy b, Zero::zero()));
13961394
}
13971395
if !b.is_zero() {
1398-
assert!(c.div_rem(&b) == (a.clone(), Zero::zero()));
1396+
assert!(c.div_rem(&b) == (copy a, Zero::zero()));
13991397
}
14001398
}
14011399

@@ -1557,7 +1555,7 @@ mod biguint_tests {
15571555
15581556
#[cfg(test)]
15591557
mod bigint_tests {
1560-
use super::*;
1558+
use super::{BigInt, BigUint, BigDigit, Sign, Minus, Zero, Plus};
15611559
use core::cmp::{Less, Equal, Greater};
15621560
use core::num::{IntConvertible, Zero, One, FromStrRadix};
15631561

branches/auto/src/rt/rust_task.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@
175175
#define RED_ZONE_SIZE RZ_MAC_32
176176
#endif
177177

178+
#ifndef RED_ZONE_SIZE
179+
# error "Red zone not defined for this platform"
180+
#endif
181+
178182
struct frame_glue_fns {
179183
uintptr_t mark_glue_off;
180184
uintptr_t drop_glue_off;

0 commit comments

Comments
 (0)