@@ -481,7 +481,6 @@ pub impl BigUint {
481
481
}
482
482
}
483
483
484
- #[ cfg( target_arch = "x86_64" ) ]
485
484
priv pure fn get_radix_base ( radix : uint ) -> ( uint , uint ) {
486
485
assert 1 < radix && radix <= 16 ;
487
486
match radix {
@@ -504,30 +503,6 @@ priv pure fn get_radix_base(radix: uint) -> (uint, uint) {
504
503
}
505
504
}
506
505
507
- #[ cfg( target_arch = "arm" ) ]
508
- #[ cfg( target_arch = "x86" ) ]
509
- priv pure fn get_radix_base ( radix : uint ) -> ( uint , uint ) {
510
- assert 1 < radix && radix <= 16 ;
511
- match radix {
512
- 2 => ( 65536 , 16 ) ,
513
- 3 => ( 59049 , 10 ) ,
514
- 4 => ( 65536 , 8 ) ,
515
- 5 => ( 15625 , 6 ) ,
516
- 6 => ( 46656 , 6 ) ,
517
- 7 => ( 16807 , 5 ) ,
518
- 8 => ( 32768 , 5 ) ,
519
- 9 => ( 59049 , 5 ) ,
520
- 10 => ( 10000 , 4 ) ,
521
- 11 => ( 14641 , 4 ) ,
522
- 12 => ( 20736 , 4 ) ,
523
- 13 => ( 28561 , 4 ) ,
524
- 14 => ( 38416 , 4 ) ,
525
- 15 => ( 50625 , 4 ) ,
526
- 16 => ( 65536 , 4 ) ,
527
- _ => fail
528
- }
529
- }
530
-
531
506
/// A Sign is a BigInt's composing element.
532
507
pub enum Sign { Minus , Zero , Plus }
533
508
@@ -878,6 +853,8 @@ mod biguint_tests {
878
853
}
879
854
880
855
#[test]
856
+ #[ignore(cfg(target_arch = " x86") ) ]
857
+ #[ ignore ( cfg ( target_arch = "arm" ) ) ]
881
858
fn test_shl( ) {
882
859
fn check ( v : ~[ BigDigit ] , shift : uint , ans : ~[ BigDigit ] ) {
883
860
assert BigUint :: new ( v) << shift == BigUint :: new ( ans) ;
@@ -888,34 +865,10 @@ mod biguint_tests {
888
865
check ( ~[ 1 << ( BigDigit :: bits - 2 ) ] , 2 , ~[ 0 , 1 ] ) ;
889
866
check ( ~[ 1 << ( BigDigit :: bits - 2 ) ] , 3 , ~[ 0 , 2 ] ) ;
890
867
check ( ~[ 1 << ( BigDigit :: bits - 2 ) ] , 3 + BigDigit :: bits, ~[ 0 , 0 , 2 ] ) ;
891
-
892
- test_shl_bits();
893
-
894
- #[cfg(target_arch = " x86_64") ]
895
- fn test_shl_bits( ) {
896
- check ( ~[ 0x7654_3210 , 0xfedc_ba98 ,
897
- 0x7654_3210 , 0xfedc_ba98 ] , 4 ,
898
- ~[ 0x6543_2100 , 0xedcb_a987 ,
899
- 0x6543_210f , 0xedcb_a987 , 0xf ] ) ;
900
- check ( ~[ 0x2222_1111 , 0x4444_3333 ,
901
- 0x6666_5555 , 0x8888_7777 ] , 16 ,
902
- ~[ 0x1111_0000 , 0x3333_2222 ,
903
- 0x5555_4444 , 0x7777_6666 , 0x8888 ] ) ;
904
- }
905
-
906
- #[ cfg( target_arch = "arm" ) ]
907
- #[ cfg( target_arch = "x86" ) ]
908
- fn test_shl_bits ( ) {
909
- check ( ~[ 0x3210 , 0x7654 , 0xba98 , 0xfedc ,
910
- 0x3210 , 0x7654 , 0xba98 , 0xfedc ] , 4 ,
911
- ~[ 0x2100 , 0x6543 , 0xa987 , 0xedcb ,
912
- 0x210f , 0x6543 , 0xa987 , 0xedcb , 0xf ] ) ;
913
- check ( ~[ 0x1111 , 0x2222 , 0x3333 , 0x4444 ,
914
- 0x5555 , 0x6666 , 0x7777 , 0x8888 ] , 16 ,
915
- ~[ 0x0000 , 0x1111 , 0x2222 , 0x3333 ,
916
- 0x4444 , 0x5555 , 0x6666 , 0x7777 , 0x8888 ] ) ;
917
- }
918
-
868
+ check ( ~[ 0x7654_3210 , 0xfedc_ba98 , 0x7654_3210 , 0xfedc_ba98 ] , 4 ,
869
+ ~[ 0x6543_2100 , 0xedcb_a987 , 0x6543_210f , 0xedcb_a987 , 0xf ] ) ;
870
+ check ( ~[ 0x2222_1111 , 0x4444_3333 , 0x6666_5555 , 0x8888_7777 ] , 16 ,
871
+ ~[ 0x1111_0000 , 0x3333_2222 , 0x5555_4444 , 0x7777_6666 , 0x8888 ] ) ;
919
872
}
920
873
921
874
#[ test]
@@ -932,32 +885,11 @@ mod biguint_tests {
932
885
check ( ~[ 1 << 2 ] , 2 , ~[ 1 ] ) ;
933
886
check ( ~[ 1 , 2 ] , 3 , ~[ 1 << ( BigDigit :: bits - 2 ) ] ) ;
934
887
check ( ~[ 1 , 1 , 2 ] , 3 + BigDigit :: bits, ~[ 1 << ( BigDigit :: bits - 2 ) ] ) ;
935
- test_shr_bits ( ) ;
936
-
937
- #[ cfg( target_arch = "x86_64" ) ]
938
- fn test_shr_bits ( ) {
939
- check ( ~[ 0x6543_2100 , 0xedcb_a987 ,
940
- 0x6543_210f , 0xedcb_a987 , 0xf ] , 4 ,
941
- ~[ 0x7654_3210 , 0xfedc_ba98 ,
942
- 0x7654_3210 , 0xfedc_ba98 ] ) ;
943
- check ( ~[ 0x1111_0000 , 0x3333_2222 ,
944
- 0x5555_4444 , 0x7777_6666 , 0x8888 ] , 16 ,
945
- ~[ 0x2222_1111 , 0x4444_3333 ,
946
- 0x6666_5555 , 0x8888_7777 ] ) ;
947
- }
948
-
949
- #[ cfg( target_arch = "arm" ) ]
950
- #[ cfg( target_arch = "x86" ) ]
951
- fn test_shr_bits ( ) {
952
- check ( ~[ 0x2100 , 0x6543 , 0xa987 , 0xedcb ,
953
- 0x210f , 0x6543 , 0xa987 , 0xedcb , 0xf ] , 4 ,
954
- ~[ 0x3210 , 0x7654 , 0xba98 , 0xfedc ,
955
- 0x3210 , 0x7654 , 0xba98 , 0xfedc ] ) ;
956
- check ( ~[ 0x0000 , 0x1111 , 0x2222 , 0x3333 ,
957
- 0x4444 , 0x5555 , 0x6666 , 0x7777 , 0x8888 ] , 16 ,
958
- ~[ 0x1111 , 0x2222 , 0x3333 , 0x4444 ,
959
- 0x5555 , 0x6666 , 0x7777 , 0x8888 ] ) ;
960
- }
888
+ check ( ~[ 0x6543_2100 , 0xedcb_a987 , 0x6543_210f , 0xedcb_a987 , 0xf ] , 4 ,
889
+ ~[ 0x7654_3210 , 0xfedc_ba98 , 0x7654_3210 , 0xfedc_ba98 ] ) ;
890
+ check ( ~[ 0x1111_0000 , 0x3333_2222 , 0x5555_4444 , 0x7777_6666 , 0x8888 ] ,
891
+ 16 ,
892
+ ~[ 0x2222_1111 , 0x4444_3333 , 0x6666_5555 , 0x8888_7777 ] ) ;
961
893
}
962
894
963
895
#[ test]
@@ -1122,7 +1054,6 @@ mod biguint_tests {
1122
1054
}
1123
1055
1124
1056
fn to_str_pairs ( ) -> ~[ ( BigUint , ~[ ( uint , ~str ) ] ) ] {
1125
- let bits = BigDigit :: bits;
1126
1057
~[ ( Zero :: zero ( ) , ~[
1127
1058
( 2 , ~"0 ") , ( 3 , ~"0 ")
1128
1059
] ) , ( BigUint :: from_slice ( [ 0xff ] ) , ~[
@@ -1146,39 +1077,24 @@ mod biguint_tests {
1146
1077
( 4 , ~"333333 ") ,
1147
1078
( 16 , ~"fff")
1148
1079
] ) , ( BigUint :: from_slice ( [ 1 , 2 ] ) , ~[
1149
- ( 2 ,
1150
- ~"10 " +
1151
- str:: from_chars ( vec:: from_elem ( bits - 1 , '0' ) ) + "1" ) ,
1152
- ( 4 ,
1153
- ~"2 " +
1154
- str:: from_chars ( vec:: from_elem ( bits / 2 - 1 , '0' ) ) + "1" ) ,
1155
- ( 10 , match bits {
1156
- 32 => ~"8589934593 ", 16 => ~"131073 ", _ => fail
1157
- } ) ,
1158
- ( 16 ,
1159
- ~"2 " +
1160
- str:: from_chars ( vec:: from_elem ( bits / 4 - 1 , '0' ) ) + "1" )
1161
- ] ) , ( BigUint :: from_slice ( [ 1 , 2 , 3 ] ) , ~[
1162
- ( 2 ,
1163
- ~"11 " +
1164
- str:: from_chars ( vec:: from_elem ( bits - 2 , '0' ) ) + "10" +
1165
- str:: from_chars ( vec:: from_elem ( bits - 1 , '0' ) ) + "1" ) ,
1166
- ( 4 ,
1167
- ~"3 " +
1168
- str:: from_chars ( vec:: from_elem ( bits / 2 - 1 , '0' ) ) + "2" +
1169
- str:: from_chars ( vec:: from_elem ( bits / 2 - 1 , '0' ) ) + "1" ) ,
1170
- ( 10 , match bits {
1171
- 32 => ~"55340232229718589441 ",
1172
- 16 => ~"12885032961 ",
1173
- _ => fail
1174
- } ) ,
1175
- ( 16 , ~"3 " +
1176
- str:: from_chars ( vec:: from_elem ( bits / 4 - 1 , '0' ) ) + "2" +
1177
- str:: from_chars ( vec:: from_elem ( bits / 4 - 1 , '0' ) ) + "1" )
1178
- ] ) ]
1080
+ ( 2 , ~"10 " + str:: from_chars ( vec:: from_elem ( 31 , '0' ) ) + "1" ) ,
1081
+ ( 4 , ~"2 " + str:: from_chars ( vec:: from_elem ( 15 , '0' ) ) + "1" ) ,
1082
+ ( 10 , ~"8589934593 ") ,
1083
+ ( 16 , ~"2 " + str:: from_chars ( vec:: from_elem ( 7 , '0' ) ) + "1" )
1084
+ ] ) , ( BigUint :: from_slice ( [ 1 , 2 , 3 ] ) , ~[
1085
+ ( 2 , ~"11 " + str:: from_chars ( vec:: from_elem ( 30 , '0' ) ) + "10" +
1086
+ str:: from_chars ( vec:: from_elem ( 31 , '0' ) ) + "1" ) ,
1087
+ ( 4 , ~"3 " + str:: from_chars ( vec:: from_elem ( 15 , '0' ) ) + "2" +
1088
+ str:: from_chars ( vec:: from_elem ( 15 , '0' ) ) + "1" ) ,
1089
+ ( 10 , ~"55340232229718589441 ") ,
1090
+ ( 16 , ~"3 " + str:: from_chars ( vec:: from_elem ( 7 , '0' ) ) + "2" +
1091
+ str:: from_chars ( vec:: from_elem ( 7 , '0' ) ) + "1" )
1092
+ ] ) ]
1179
1093
}
1180
1094
1181
1095
#[ test]
1096
+ #[ ignore( cfg( target_arch = "x86" ) ) ]
1097
+ #[ ignore( cfg( target_arch = "arm" ) ) ]
1182
1098
fn test_to_str_radix( ) {
1183
1099
for to_str_pairs( ) . each |num_pair| {
1184
1100
let & ( n, rs) = num_pair;
@@ -1190,6 +1106,8 @@ mod biguint_tests {
1190
1106
}
1191
1107
1192
1108
#[ test]
1109
+ #[ ignore( cfg( target_arch = "x86" ) ) ]
1110
+ #[ ignore( cfg( target_arch = "arm" ) ) ]
1193
1111
fn test_from_str_radix( ) {
1194
1112
for to_str_pairs( ) . each |num_pair| {
1195
1113
let & ( n, rs) = num_pair;
0 commit comments