equal
deleted
inserted
replaced
792 ^ BCDConversionErrorSignal |
792 ^ BCDConversionErrorSignal |
793 |
793 |
794 "Modified: / 15.11.1999 / 20:35:20 / cg" |
794 "Modified: / 15.11.1999 / 20:35:20 / cg" |
795 ! ! |
795 ! ! |
796 |
796 |
797 |
|
798 |
|
799 !Integer class methodsFor:'class initialization'! |
797 !Integer class methodsFor:'class initialization'! |
800 |
798 |
801 initialize |
799 initialize |
802 BCDConversionErrorSignal isNil ifTrue:[ |
800 BCDConversionErrorSignal isNil ifTrue:[ |
803 BCDConversionErrorSignal := ConversionError newSignal. |
801 BCDConversionErrorSignal := ConversionError newSignal. |
849 |
847 |
850 ^ 0 |
848 ^ 0 |
851 |
849 |
852 "Modified: 18.7.1996 / 12:26:38 / cg" |
850 "Modified: 18.7.1996 / 12:26:38 / cg" |
853 ! ! |
851 ! ! |
854 |
|
855 |
852 |
856 !Integer class methodsFor:'prime numbers'! |
853 !Integer class methodsFor:'prime numbers'! |
857 |
854 |
858 flushPrimeCache |
855 flushPrimeCache |
859 "cleanup after using a primeCache. |
856 "cleanup after using a primeCache. |
1227 True is returned for Integer here; false for subclasses. |
1224 True is returned for Integer here; false for subclasses. |
1228 Abstract subclasses must redefine this again." |
1225 Abstract subclasses must redefine this again." |
1229 |
1226 |
1230 ^ self == Integer |
1227 ^ self == Integer |
1231 ! ! |
1228 ! ! |
1232 |
|
1233 |
1229 |
1234 !Integer methodsFor:'Compatibility-Dolphin'! |
1230 !Integer methodsFor:'Compatibility-Dolphin'! |
1235 |
1231 |
1236 highWord |
1232 highWord |
1237 "return the high 16 bits of a 32 bit value" |
1233 "return the high 16 bits of a 32 bit value" |
4824 "speed up a lot for large primes" |
4820 "speed up a lot for large primes" |
4825 ^ PrimeNumberGenerator isPrime:self. |
4821 ^ PrimeNumberGenerator isPrime:self. |
4826 ]. |
4822 ]. |
4827 |
4823 |
4828 "/ Not absolutely correct, but was broken much worse before. |
4824 "/ Not absolutely correct, but was broken much worse before. |
4829 limit := self sqrt. |
4825 limit := self integerSqrt. |
4830 limit isNaN ifTrue:[ |
|
4831 DomainError raiseRequestErrorString:'Number too large for current fallback implementation.'. |
|
4832 ]. |
|
4833 limit := limit asInteger. |
|
4834 (firstFewPrimes last+2) to:limit by:2 do:[:i | |
4826 (firstFewPrimes last+2) to:limit by:2 do:[:i | |
4835 (self \\ i) == 0 ifTrue:[ ^ false ]. |
4827 (self \\ i) == 0 ifTrue:[ ^ false ]. |
4836 ]. |
4828 ]. |
4837 ^ true |
4829 ^ true |
4838 |
4830 |
4986 ] |
4978 ] |
4987 " |
4979 " |
4988 |
4980 |
4989 "Created: / 09-01-2012 / 17:18:06 / cg" |
4981 "Created: / 09-01-2012 / 17:18:06 / cg" |
4990 ! ! |
4982 ! ! |
4991 |
|
4992 |
4983 |
4993 !Integer methodsFor:'special modulo arithmetic'! |
4984 !Integer methodsFor:'special modulo arithmetic'! |
4994 |
4985 |
4995 add_32:anInteger |
4986 add_32:anInteger |
4996 "return a C-semantic 32bit sum of the receiver and the argument. |
4987 "return a C-semantic 32bit sum of the receiver and the argument. |