equal
deleted
inserted
replaced
19 |
19 |
20 SmallInteger comment:' |
20 SmallInteger comment:' |
21 COPYRIGHT (c) 1988 by Claus Gittinger |
21 COPYRIGHT (c) 1988 by Claus Gittinger |
22 All Rights Reserved |
22 All Rights Reserved |
23 |
23 |
24 $Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.25 1995-03-25 01:24:01 claus Exp $ |
24 $Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.26 1995-03-31 02:52:18 claus Exp $ |
25 '! |
25 '! |
26 |
26 |
27 !SmallInteger class methodsFor:'documentation'! |
27 !SmallInteger class methodsFor:'documentation'! |
28 |
28 |
29 copyright |
29 copyright |
40 " |
40 " |
41 ! |
41 ! |
42 |
42 |
43 version |
43 version |
44 " |
44 " |
45 $Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.25 1995-03-25 01:24:01 claus Exp $ |
45 $Header: /cvs/stx/stx/libbasic/SmallInteger.st,v 1.26 1995-03-31 02:52:18 claus Exp $ |
46 " |
46 " |
47 ! |
47 ! |
48 |
48 |
49 documentation |
49 documentation |
50 " |
50 " |
789 } |
789 } |
790 } |
790 } |
791 %} |
791 %} |
792 . |
792 . |
793 aNumber isInteger ifTrue:[ |
793 aNumber isInteger ifTrue:[ |
794 aNumber = 0 ifTrue:[ |
794 aNumber == 0 ifTrue:[ |
795 ^ DivisionByZeroSignal raise. |
795 ^ DivisionByZeroSignal raise. |
796 ]. |
796 ]. |
797 ^ Fraction numerator:self denominator:aNumber |
797 ^ Fraction numerator:self denominator:aNumber |
798 ]. |
798 ]. |
799 ^ aNumber quotientFromInteger:self |
799 ^ aNumber quotientFromInteger:self |
873 RETURN (self); |
873 RETURN (self); |
874 } |
874 } |
875 if (val != _MIN_INT) { |
875 if (val != _MIN_INT) { |
876 RETURN ( _MKSMALLINT(-val) ); |
876 RETURN ( _MKSMALLINT(-val) ); |
877 } |
877 } |
878 %} |
878 %}. |
879 . |
|
880 "only reached for minVal" |
879 "only reached for minVal" |
881 ^ self negated |
880 ^ self negated |
882 ! |
881 ! |
883 |
882 |
884 negated |
883 negated |
890 INT val = _intVal(self); |
889 INT val = _intVal(self); |
891 |
890 |
892 if (val != _MIN_INT) { |
891 if (val != _MIN_INT) { |
893 RETURN ( _MKSMALLINT(- val) ); |
892 RETURN ( _MKSMALLINT(- val) ); |
894 } |
893 } |
895 %} |
894 %}. |
896 . |
895 "only reached for minVal" |
897 ^ (LargeInteger value:(SmallInteger maxVal)) + 1 |
896 ^ (LargeInteger value:(SmallInteger maxVal)) + 1 |
898 ! ! |
897 ! ! |
899 |
898 |
900 !SmallInteger methodsFor:'modulu arithmetic'! |
899 !SmallInteger methodsFor:'modulu arithmetic'! |
901 |
900 |
1701 #endif |
1700 #endif |
1702 sprintf(buffer, format, _intVal(self)); |
1701 sprintf(buffer, format, _intVal(self)); |
1703 #ifdef THISCONTEXT_IN_REGISTER |
1702 #ifdef THISCONTEXT_IN_REGISTER |
1704 __thisContext = sav; |
1703 __thisContext = sav; |
1705 #endif |
1704 #endif |
1706 newString = _MKSTRING(buffer COMMA_SND); |
1705 newString = _MKSTRING(buffer COMMA_SND); |
1707 if (newString != nil) { |
1706 if (newString != nil) { |
1708 RETURN (newString); |
1707 RETURN (newString); |
1709 } |
1708 } |
1710 } |
1709 } |
1711 %}. |
1710 %}. |
1712 " |
1711 " |
1713 fall back for seldom used bases |
1712 fall back for seldom used bases |
1714 " |
1713 " |