Changeset 776
- Timestamp:
- 07/01/08 02:55:31 (4 months ago)
- Files:
-
- trunk/phobos/std/bigint.d (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phobos/std/bigint.d
r773 r776 80 80 void opAssign(uint n) 81 81 { 82 static if(BIG_ENDIAN) { autoa = [ cast(Digit)0, n ]; }83 else { autoa = [ cast(Digit)n, 0 ]; }82 static if(BIG_ENDIAN) { Digits a = [ cast(Digit)0, n ]; } 83 else { Digits a = [ cast(Digit)n, 0 ]; } 84 84 Big b = bigInt(a); 85 85 digits = b.digits; … … 89 89 void opAssign(long n) 90 90 { 91 static if(BIG_ENDIAN) { autoa = [ cast(Digit)(n>>32), cast(Digit)n ]; }92 else { autoa = [ cast(Digit)n, cast(Digit)(n>>32) ]; }91 static if(BIG_ENDIAN) { Digits a = [ cast(Digit)(n>>32), cast(Digit)n ]; } 92 else { Digits a = [ cast(Digit)n, cast(Digit)(n>>32) ]; } 93 93 Big b = bigInt(a); 94 94 digits = b.digits; … … 98 98 void opAssign(ulong n) 99 99 { 100 static if(BIG_ENDIAN) { autoa = [ cast(Digit)0, cast(Digit)(n>>32), cast(Digit)n ]; }101 else { autoa = [ cast(Digit)n, cast(Digit)(n>>32), cast(Digit)0 ]; }100 static if(BIG_ENDIAN) { Digits a = [ cast(Digit)0, cast(Digit)(n>>32), cast(Digit)n ]; } 101 else { Digits a = [ cast(Digit)n, cast(Digit)(n>>32), cast(Digit)0 ]; } 102 102 Big b = bigInt(a); 103 103 digits = b.digits; … … 623 623 // to run in reverse endianness. (And they still pass). 624 624 625 version(BigEndian) { enum bool BIG_ENDIAN = true; }625 version(BigEndian) { enum bool BIG_ENDIAN = true; } 626 626 else { enum bool BIG_ENDIAN = false; } 627 627 … … 686 686 687 687 case 'a','b','c','d','e','f': 688 r = (r << 4) + (c - ' A' + 10);688 r = (r << 4) + (c - 'a' + 10); 689 689 invalid = false; 690 690 break; … … 1899 1899 r.opAssign(z); 1900 1900 assert(z.digits == r.digits, hex(r)); 1901 /+//1901 // 1902 1902 r.opAssign( cast(int)100 ); 1903 1903 assert(z.digits == r.digits, hex(r)); … … 1924 1924 Big z = makeBig( 0x00000000, 0xFEDCBA98, 0x76543210 ); 1925 1925 assert(z.digits == r.digits, hex(r)); 1926 +/1927 } 1928 /+ 1926 1927 } 1928 1929 1929 // This block of unittests demonstrates that static opCall works 1930 1930 { … … 1956 1956 assert(z.digits == r.digits, hex(r)); 1957 1957 } 1958 +/1959 1958 1960 1959 // This block of unittests demonstrates that castTo works … … 2164 2163 a %= i; 2165 2164 } 2166 /+ 2165 2167 2166 // This block of unittests demonstrates that opAnd works 2168 2167 { … … 2198 2197 assert(x == 0x66666666); 2199 2198 } 2200 +/2201 2199 2202 2200 // This block of unittests demonstrates that opShl works
