# HG changeset patch # User Claus Gittinger # Date 1445964128 -3600 # Node ID 646aee8aa03ae94dd0890c4ef3a76fd39dd80898 # Parent 0db793427e55dbebc0a51cfc9599c49cfeb14d27 #DOCUMENTATION class: SmallInteger typos in comment/format in: diff -r 0db793427e55 -r 646aee8aa03a SmallInteger.st --- a/SmallInteger.st Tue Oct 27 17:41:19 2015 +0100 +++ b/SmallInteger.st Tue Oct 27 17:42:08 2015 +0100 @@ -439,7 +439,7 @@ ! + aNumber - "return the sum of the receivers value and the arguments value" + "return the sum of the receiver's value and the argument's value" %{ /* NOCONTEXT */ #ifdef __SCHTEAM__ @@ -457,30 +457,30 @@ if (__isSmallInteger(aNumber)) { # ifdef _ADD_IO_IO - RETURN ( _ADD_IO_IO(self, aNumber) ); + RETURN ( _ADD_IO_IO(self, aNumber) ); # else - REGISTER INT sum; - - sum = __intVal(self) + __intVal(aNumber); - if (__ISVALIDINTEGER(sum)) { - RETURN ( __mkSmallInteger(sum) ); - } - RETURN ( __MKLARGEINT(sum) ); + REGISTER INT sum; + + sum = __intVal(self) + __intVal(aNumber); + if (__ISVALIDINTEGER(sum)) { + RETURN ( __mkSmallInteger(sum) ); + } + RETURN ( __MKLARGEINT(sum) ); # endif } if (__isFloatLike(aNumber)) { - OBJ newFloat; - double val = (double)__intVal(self) + __floatVal(aNumber); - - __qMKFLOAT(newFloat, val); - RETURN ( newFloat ); + OBJ newFloat; + double val = (double)__intVal(self) + __floatVal(aNumber); + + __qMKFLOAT(newFloat, val); + RETURN ( newFloat ); } if (__isShortFloat(aNumber)) { - OBJ newFloat; - float val = (float)__intVal(self) + __shortFloatVal(aNumber); - - __qMKSFLOAT(newFloat, val); - RETURN ( newFloat ); + OBJ newFloat; + float val = (float)__intVal(self) + __shortFloatVal(aNumber); + + __qMKSFLOAT(newFloat, val); + RETURN ( newFloat ); } #endif /* not __SCHTEAM__ */ %}. @@ -488,7 +488,7 @@ ! - aNumber - "return the difference of the receivers value and the arguments value" + "return the difference of the receiver's value and the argument's value" %{ /* NOCONTEXT */ #ifdef __SCHTEAM__ @@ -506,30 +506,30 @@ if (__isSmallInteger(aNumber)) { # ifdef _SUB_IO_IO - RETURN ( _SUB_IO_IO(self, aNumber) ); + RETURN ( _SUB_IO_IO(self, aNumber) ); # else - REGISTER INT diff; - - diff = __intVal(self) - __intVal(aNumber); - if (__ISVALIDINTEGER(diff)) { - RETURN ( __mkSmallInteger(diff) ); - } - RETURN ( __MKLARGEINT(diff) ); + REGISTER INT diff; + + diff = __intVal(self) - __intVal(aNumber); + if (__ISVALIDINTEGER(diff)) { + RETURN ( __mkSmallInteger(diff) ); + } + RETURN ( __MKLARGEINT(diff) ); # endif } if (__isFloatLike(aNumber)) { - OBJ newFloat; - double val = (double)__intVal(self) - __floatVal(aNumber); - - __qMKFLOAT(newFloat, val); - RETURN ( newFloat ); + OBJ newFloat; + double val = (double)__intVal(self) - __floatVal(aNumber); + + __qMKFLOAT(newFloat, val); + RETURN ( newFloat ); } if (__isShortFloat(aNumber)) { - OBJ newFloat; - float val = (float)__intVal(self) - __shortFloatVal(aNumber); - - __qMKSFLOAT(newFloat, val); - RETURN ( newFloat ); + OBJ newFloat; + float val = (float)__intVal(self) - __shortFloatVal(aNumber); + + __qMKSFLOAT(newFloat, val); + RETURN ( newFloat ); } #endif /* not __SCHTEAM__ */ %}. @@ -537,7 +537,7 @@ ! / aNumber - "return the quotient of the receivers value and the arguments value" + "return the quotient of the receiver's value and the argument's value" %{ /* NOCONTEXT */ #ifdef __SCHTEAM__ @@ -558,45 +558,45 @@ double dval; if (__isSmallInteger(aNumber)) { - val = __intVal(aNumber); - if (val != 0) { - me = __intVal(self); - t = me / val; + val = __intVal(aNumber); + if (val != 0) { + me = __intVal(self); + t = me / val; # ifdef GOOD_OPTIMIZER - if (me % val == 0) { + if (me % val == 0) { # else - /* this is stupid - all I want is to look for a remainder ... - but most compilers are too stupid and generate an extra modulus - instruction for "if (me % val)". - Even if most divide instructions already leave the remainder in - some register. - Therefore I use a multiplication which is faster than a modulo - on most machines. Hint to GNU people :-) - */ - if ((t * val) == me) { + /* this is stupid - all I want is to look for a remainder ... + but most compilers are too stupid and generate an extra modulus + instruction for "if (me % val)". + Even if most divide instructions already leave the remainder in + some register. + Therefore I use a multiplication which is faster than a modulo + on most machines. Hint to GNU people :-) + */ + if ((t * val) == me) { # endif - RETURN ( __mkSmallInteger(t) ); - } - } + RETURN ( __mkSmallInteger(t) ); + } + } } else { - if (__isFloatLike(aNumber)) { - dval = __floatVal(aNumber); - if (dval != 0.0) { - OBJ newFloat; - double val = (double)__intVal(self) / dval; - - __qMKFLOAT(newFloat, val); - RETURN ( newFloat ); - } - } + if (__isFloatLike(aNumber)) { + dval = __floatVal(aNumber); + if (dval != 0.0) { + OBJ newFloat; + double val = (double)__intVal(self) / dval; + + __qMKFLOAT(newFloat, val); + RETURN ( newFloat ); + } + } } #endif /* not __SCHTEAM__ */ %}. aNumber isInteger ifTrue:[ - aNumber == 0 ifTrue:[ - ^ ZeroDivide raiseRequestWith:thisContext. - ]. - ^ Fraction numerator:self denominator:aNumber + aNumber == 0 ifTrue:[ + ^ ZeroDivide raiseRequestWith:thisContext. + ]. + ^ Fraction numerator:self denominator:aNumber ]. ^ aNumber quotientFromInteger:self @@ -614,8 +614,8 @@ ! // aNumber - "return the integer part of the quotient of the receivers value - and the arguments value. + "return the integer part of the quotient of the receiver's value + and the argument's value. The result is truncated toward negative infinity and will be negative, if the operands signs differ. The following is always true: @@ -895,8 +895,8 @@ ! quo:aNumber - "return the integer part of the quotient of the receivers value - and the arguments value. The result is truncated towards zero + "return the integer part of the quotient of the receiver's value + and the argument's value. The result is truncated towards zero and negative, if the operands signs differ.. The following is always true: (receiver quo: aNumber) * aNumber + (receiver rem: aNumber) = receiver