--- a/SmallInteger.st Wed Aug 30 23:34:12 2017 +0200
+++ b/SmallInteger.st Thu Aug 31 10:28:35 2017 +0200
@@ -980,20 +980,20 @@
extern double sqrt();
if (val >= 0.0) {
- RETURN (__MKFLOAT(sqrt(val)));
+ RETURN (__MKFLOAT(sqrt(val)));
}
#endif
%}.
^ self class
- raise:#imaginaryResultSignal
- receiver:self
- selector:#sqrt
- arguments:#()
- errorString:'bad (negative) receiver in sqrt'
+ raise:#imaginaryResultSignal
+ receiver:self
+ selector:#sqrt
+ arguments:#()
+ errorString:'bad (negative) receiver in sqrt'
"
- 2 sqrt
- -2 sqrt
+ 2 sqrt
+ -2 sqrt
"
"Created: / 08-05-2017 / 14:57:07 / stefan"
@@ -1224,11 +1224,11 @@
This is the inverse operation from bitInterleave: - see comment there.
i.e. if count is 3,
and the receiver's bits are
- cN bN aN ... c2 b2 a2 c1 b1 a1 c0 b0 a0
+ cN bN aN ... c2 b2 a2 c1 b1 a1 c0 b0 a0
then the result will be a vector containing the numbers a,b,c with bits:
- aN ... a2 a1 a0
- bN ... b2 b1 b0
- cN ... c2 c1 c0."
+ aN ... a2 a1 a0
+ bN ... b2 b1 b0
+ cN ... c2 c1 c0."
%{
#if __POINTER_SIZE__ == 8
@@ -1263,46 +1263,46 @@
#endif
- unsigned INT bits = __intVal(self);
+ unsigned INT bits = __intVal(self);
unsigned INT a, b;
if (n == __MKSMALLINT(2)) {
# define morton2(x,dst) \
- { \
- unsigned INT t; \
- t = (x) & M5555555555555555; \
- t = (t | (t >> 1)) & M3333333333333333; \
- t = (t | (t >> 2)) & M0f0f0f0f0f0f0f0f; \
- t = (t | (t >> 4)) & M00ff00ff00ff00ff; \
- t = (t | (t >> 8)) & M0000ffff0000ffff; \
- t = (t | (t >> 16)) & M00000000ffffffff; \
- dst = t; \
- }
-
- morton2(bits, a);
- morton2(bits>>1, b);
- RETURN (__ARRAY_WITH2(__MKSMALLINT(a), __MKSMALLINT(b)));
+ { \
+ unsigned INT t; \
+ t = (x) & M5555555555555555; \
+ t = (t | (t >> 1)) & M3333333333333333; \
+ t = (t | (t >> 2)) & M0f0f0f0f0f0f0f0f; \
+ t = (t | (t >> 4)) & M00ff00ff00ff00ff; \
+ t = (t | (t >> 8)) & M0000ffff0000ffff; \
+ t = (t | (t >> 16)) & M00000000ffffffff; \
+ dst = t; \
+ }
+
+ morton2(bits, a);
+ morton2(bits>>1, b);
+ RETURN (__ARRAY_WITH2(__MKSMALLINT(a), __MKSMALLINT(b)));
}
-
+
if (n == __MKSMALLINT(3)) {
- unsigned INT c;
+ unsigned INT c;
# define morton3(x,dst) \
- { \
- unsigned INT t; \
- t = (x) & M9249249249249249; \
- t = (t | (t >> 2)) & M30c30c30c30c30c3; \
- t = (t | (t >> 4)) & Mf00f00f00f00f00f; \
- t = (t | (t >> 8)) & M00ff0000ff0000ff; \
- t = (t | (t >> 16)) & Mffff00000000ffff; \
- t = (t | (t >> 32)) & M00000000ffffffff; \
- dst = t; \
- }
-
- morton3(bits, a);
- morton3(bits>>1, b);
- morton3(bits>>2, c);
- RETURN (__ARRAY_WITH3(__MKSMALLINT(a), __MKSMALLINT(b), __MKSMALLINT(c)));
+ { \
+ unsigned INT t; \
+ t = (x) & M9249249249249249; \
+ t = (t | (t >> 2)) & M30c30c30c30c30c3; \
+ t = (t | (t >> 4)) & Mf00f00f00f00f00f; \
+ t = (t | (t >> 8)) & M00ff0000ff0000ff; \
+ t = (t | (t >> 16)) & Mffff00000000ffff; \
+ t = (t | (t >> 32)) & M00000000ffffffff; \
+ dst = t; \
+ }
+
+ morton3(bits, a);
+ morton3(bits>>1, b);
+ morton3(bits>>2, c);
+ RETURN (__ARRAY_WITH3(__MKSMALLINT(a), __MKSMALLINT(b), __MKSMALLINT(c)));
}
done: ;
%}.
@@ -1316,23 +1316,23 @@
|a b|
(0 to:31) do:[:bitA |
- a := 1 << bitA.
- (0 to:31) do:[:bitB |
- b := 1 << bitB.
- self assert:( (a bitInterleaveWith:b) bitDeinterleave:2 ) = {a . b }
- ].
+ a := 1 << bitA.
+ (0 to:31) do:[:bitB |
+ b := 1 << bitB.
+ self assert:( (a bitInterleaveWith:b) bitDeinterleave:2 ) = {a . b }
+ ].
].
|a b c|
(0 to:31) do:[:bitA |
- a := 1 << bitA.
- (0 to:31) do:[:bitB |
- b := 1 << bitB.
- (0 to:31) do:[:bitC |
- c := 1 << bitC.
- self assert:( (a bitInterleaveWith:b and:c) bitDeinterleave:3 ) = {a . b . c}
- ].
- ].
+ a := 1 << bitA.
+ (0 to:31) do:[:bitB |
+ b := 1 << bitB.
+ (0 to:31) do:[:bitC |
+ c := 1 << bitC.
+ self assert:( (a bitInterleaveWith:b and:c) bitDeinterleave:3 ) = {a . b . c}
+ ].
+ ].
].
"
@@ -1340,18 +1340,18 @@
!
bitInterleaveWith:anInteger
- "generate a Morton number (-> https://en.wikipedia.org/wiki/Morton_number_(number_theory))
- by interleaving bits of the receiver
+ "generate a Morton number (-> https://en.wikipedia.org/wiki/Morton_number_(number_theory))
+ by interleaving bits of the receiver
(at even positions if counting from 1) with bits of the argument (at odd bit positions).
Thus, if the bits of the receiver are
- aN ... a2 a1 a0
+ aN ... a2 a1 a0
and those of the argument are:
- bN ... b2 b1 b0
+ bN ... b2 b1 b0
the result is
- bN aN ... b2 a2 b1 a1 b0 a0.
+ bN aN ... b2 a2 b1 a1 b0 a0.
Morton numbers are great to linearize 2D coordinates
- eg. to sort 2D points by distances"
+ eg. to sort 2D points by distances"
%{
#if __POINTER_SIZE__ == 8
@@ -1360,28 +1360,28 @@
// the following is only faster, if multiplication is faster than a memory fetch
if (__isSmallInteger(anInteger)) {
- INT _a = __intVal(self);
- INT _b = __intVal(anInteger);
-
- if ( (((unsigned)_a)<=0xFFFFFFFF) && (((unsigned)_b)<=0xFFFFFFFF) ) {
- int shift = 0;
- unsigned INT val = 0;
-
- // Interleave bits of (8-bit) a and b, so that all of the
- // bits of a are in the even positions and b in the odd;
- // resulting in a 16-bit Morton Number.
+ INT _a = __intVal(self);
+ INT _b = __intVal(anInteger);
+
+ if ( (((unsigned)_a)<=0xFFFFFFFF) && (((unsigned)_b)<=0xFFFFFFFF) ) {
+ int shift = 0;
+ unsigned INT val = 0;
+
+ // Interleave bits of (8-bit) a and b, so that all of the
+ // bits of a are in the even positions and b in the odd;
+ // resulting in a 16-bit Morton Number.
# define interleaveBytes(a,b) \
- ((((a * 0x0101010101010101ULL & 0x8040201008040201ULL) * 0x0102040810204081ULL >> 49) & 0x5555) \
- | (((b * 0x0101010101010101ULL & 0x8040201008040201ULL) * 0x0102040810204081ULL >> 48) & 0xAAAA))
-
- while (_a | _b) {
- val |= (interleaveBytes((_a & 0xFF), (_b & 0xFF)) << shift);
- _a = _a >> 8;
- _b = _b >> 8;
- shift += 16;
- }
- RETURN (__MKUINT(val) );
- }
+ ((((a * 0x0101010101010101ULL & 0x8040201008040201ULL) * 0x0102040810204081ULL >> 49) & 0x5555) \
+ | (((b * 0x0101010101010101ULL & 0x8040201008040201ULL) * 0x0102040810204081ULL >> 48) & 0xAAAA))
+
+ while (_a | _b) {
+ val |= (interleaveBytes((_a & 0xFF), (_b & 0xFF)) << shift);
+ _a = _a >> 8;
+ _b = _b >> 8;
+ shift += 16;
+ }
+ RETURN (__MKUINT(val) );
+ }
}
# else
# if __POINTER_SIZE__ == 8
@@ -1401,29 +1401,29 @@
# endif
if (__isSmallInteger(anInteger)) {
- INT _a = __intVal(self);
- INT _b = __intVal(anInteger);
-
- if ( (((unsigned)_a)<=HALF_INT_MAX) && (((unsigned)_b)<=HALF_INT_MAX) ) {
- unsigned INT val;
-
- _a = (_a | (_a << 16)) & M0000FFFF;
- _a = (_a | (_a << 8)) & M00FF00FF;
- _a = (_a | (_a << 4)) & M0F0F0F0F;
- _a = (_a | (_a << 2)) & M33333333;
- _a = (_a | (_a << 1)) & M55555555;
-
- _b = (_b | (_b << 16)) & M0000FFFF;
- _b = (_b | (_b << 8)) & M00FF00FF;
- _b = (_b | (_b << 4)) & M0F0F0F0F;
- _b = (_b | (_b << 2)) & M33333333;
- _b = (_b | (_b << 1)) & M55555555;
-
- val = _a | (_b << 1);
- RETURN (__MKUINT(val) );
- }
+ INT _a = __intVal(self);
+ INT _b = __intVal(anInteger);
+
+ if ( (((unsigned)_a)<=HALF_INT_MAX) && (((unsigned)_b)<=HALF_INT_MAX) ) {
+ unsigned INT val;
+
+ _a = (_a | (_a << 16)) & M0000FFFF;
+ _a = (_a | (_a << 8)) & M00FF00FF;
+ _a = (_a | (_a << 4)) & M0F0F0F0F;
+ _a = (_a | (_a << 2)) & M33333333;
+ _a = (_a | (_a << 1)) & M55555555;
+
+ _b = (_b | (_b << 16)) & M0000FFFF;
+ _b = (_b | (_b << 8)) & M00FF00FF;
+ _b = (_b | (_b << 4)) & M0F0F0F0F;
+ _b = (_b | (_b << 2)) & M33333333;
+ _b = (_b | (_b << 1)) & M55555555;
+
+ val = _a | (_b << 1);
+ RETURN (__MKUINT(val) );
+ }
}
-
+
# endif
#endif
%}.
@@ -1435,11 +1435,11 @@
|a b|
(0 to:31) do:[:bitA |
- a := 1 << bitA.
- (0 to:31) do:[:bitB |
- b := 1 << bitB.
- self assert:( (a bitInterleaveWith:b) bitDeinterleave:2 ) = {a . b }
- ].
+ a := 1 << bitA.
+ (0 to:31) do:[:bitB |
+ b := 1 << bitB.
+ self assert:( (a bitInterleaveWith:b) bitDeinterleave:2 ) = {a . b }
+ ].
].
"
@@ -1816,31 +1816,31 @@
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
{
- long bits = self.longValue();
- int bitNr = 0;
-
- if (bits != 0) {
- if ((bits & 0xFFFFFFFF00000000L) != 0) {
- bitNr += 32; bits >>= 32;
- }
- if ((bits & 0xFFFF0000L) != 0) {
- bitNr += 16; bits >>= 16;
- }
- if ((bits & 0xFF00) != 0) {
- bitNr += 8; bits >>= 8;
- }
- if ((bits & 0xF0) != 0) {
- bitNr += 4; bits >>= 4;
- }
- if ((bits & 0xC) != 0) {
- bitNr += 2; bits >>= 2;
- }
- if ((bits & 0x2) != 0) {
- bitNr += 1; bits >>= 1;
- }
- bitNr += 1;
- }
- return context._RETURN( STInteger._new(bitNr) );
+ long bits = self.longValue();
+ int bitNr = 0;
+
+ if (bits != 0) {
+ if ((bits & 0xFFFFFFFF00000000L) != 0) {
+ bitNr += 32; bits >>= 32;
+ }
+ if ((bits & 0xFFFF0000L) != 0) {
+ bitNr += 16; bits >>= 16;
+ }
+ if ((bits & 0xFF00) != 0) {
+ bitNr += 8; bits >>= 8;
+ }
+ if ((bits & 0xF0) != 0) {
+ bitNr += 4; bits >>= 4;
+ }
+ if ((bits & 0xC) != 0) {
+ bitNr += 2; bits >>= 2;
+ }
+ if ((bits & 0x2) != 0) {
+ bitNr += 1; bits >>= 1;
+ }
+ bitNr += 1;
+ }
+ return context._RETURN( STInteger._new(bitNr) );
}
/* NOTREACHED */
#else
@@ -1866,8 +1866,8 @@
*/
# if (POINTER_SIZE == 4) && defined( USE_IEE_FLOAT_BITS )
union {
- double ff;
- int ll[2];
+ double ff;
+ int ll[2];
} uu;
int bNr;
@@ -1880,32 +1880,32 @@
* general fallback; not super-fast,
* but fast enough on all machines (better than a bit-masking loop, definitely).
*/
-
+
index = 0;
bits = __intVal(self);
if (bits == 0) {
- RETURN ( __mkSmallInteger(0) );
+ RETURN ( __mkSmallInteger(0) );
}
# if __POINTER_SIZE__ == 8
if (bits & 0xFFFFFFFF00000000L) {
- index += 32; bits >>= 32;
+ index += 32; bits >>= 32;
}
# endif
if (bits & 0xFFFF0000L) {
- index += 16; bits >>= 16;
+ index += 16; bits >>= 16;
}
if (bits & 0xFF00) {
- index += 8; bits >>= 8;
+ index += 8; bits >>= 8;
}
if (bits & 0xF0) {
- index += 4; bits >>= 4;
+ index += 4; bits >>= 4;
}
if (bits & 0xC) {
- index += 2; bits >>= 2;
+ index += 2; bits >>= 2;
}
if (bits & 0x2) {
- index += 1; bits >>= 1;
+ index += 1; bits >>= 1;
}
# endif /* not IEE float */
# endif /* no BSR instruction */
@@ -1924,38 +1924,38 @@
2r100000000000 highBit
((0 to:64) collect:[:s | 1 bitShift:s])
- collect:[:n | n highBit]
+ collect:[:n | n highBit]
(((0 to:64) collect:[:s | 1 bitShift:s])
- collect:[:n | n highBit]) = (1 to:65)
+ collect:[:n | n highBit]) = (1 to:65)
"
"
Time millisecondsToRun:[
- 1000000 timesRepeat:[
- 2r1 highBit
- ]
+ 1000000 timesRepeat:[
+ 2r1 highBit
+ ]
]
"
"
Time millisecondsToRun:[
- 1000000 timesRepeat:[
- 2r1111 highBit
- ]
+ 1000000 timesRepeat:[
+ 2r1111 highBit
+ ]
]
"
"
Time millisecondsToRun:[
- 1000000 timesRepeat:[
- 2r11111111111111 highBit
- ]
+ 1000000 timesRepeat:[
+ 2r11111111111111 highBit
+ ]
]
"
"
Time millisecondsToRun:[
- 1000000 timesRepeat:[
- 2r11111111111111111111111111 highBit
- ]
+ 1000000 timesRepeat:[
+ 2r11111111111111111111111111 highBit
+ ]
]
"
@@ -2095,9 +2095,9 @@
"return the value of the receiver shifted by shiftCount bits;
right shift if shiftCount > 0; left shift otherwise.
Notice: the result of bitShift: on negative receivers is not
- defined in the language standard (since the implementation
- is free to choose any internal representation for integers).
- However, ST/X preserves the sign."
+ defined in the language standard (since the implementation
+ is free to choose any internal representation for integers).
+ However, ST/X preserves the sign."
%{ /* NOCONTEXT */
#ifdef __SCHTEAM__
@@ -2105,78 +2105,78 @@
INT bits, count;
if (__isSmallInteger(shiftCount)) {
- bits = __intVal(self);
- if (bits == 0) {
- RETURN (self);
- }
-
- count = __intVal(shiftCount);
-
- if (count < 0) {
- /*
- * a left shift
- */
- count = -count;
+ bits = __intVal(self);
+ if (bits == 0) {
+ RETURN (self);
+ }
+
+ count = __intVal(shiftCount);
+
+ if (count < 0) {
+ /*
+ * a left shift
+ */
+ count = -count;
# if defined(USE_LONGLONG_FOR_SHIFT)
- if (count <= N_INT_BITS) {
- unsigned LONGLONG result;
-
- result = (unsigned LONGLONG)bits;
- result <<= count;
- if (result <= _MAX_INT) {
- RETURN ( __mkSmallInteger(result) );
- }
- {
- RETURN (__MKLARGEINT64(1, (INT)(result >> 32), (INT)(result & 0xFFFFFFFF)));
- }
- }
+ if (count <= N_INT_BITS) {
+ unsigned LONGLONG result;
+
+ result = (unsigned LONGLONG)bits;
+ result <<= count;
+ if (result <= _MAX_INT) {
+ RETURN ( __mkSmallInteger(result) );
+ }
+ {
+ RETURN (__MKLARGEINT64(1, (INT)(result >> 32), (INT)(result & 0xFFFFFFFF)));
+ }
+ }
# else
- /*
- * check for overflow
- */
- if (count < (N_INT_BITS-1)) {
- if (! (bits >> (N_INT_BITS - 1 - count))) {
- RETURN ( __mkSmallInteger(bits << count) );
- }
- /*
- * so, there is an overflow ...
- * handle it as largeInteger
- */
- /* FALL THROUGH */
- }
+ /*
+ * check for overflow
+ */
+ if (count < (N_INT_BITS-1)) {
+ if (! (bits >> (N_INT_BITS - 1 - count))) {
+ RETURN ( __mkSmallInteger(bits << count) );
+ }
+ /*
+ * so, there is an overflow ...
+ * handle it as largeInteger
+ */
+ /* FALL THROUGH */
+ }
# endif
- } else {
- if (count == 0) {
- RETURN (self);
- }
-
- /*
- * right shifts cannot overflow
- *
- * some machines ignore shifts bigger than
- * the number of bits in an int ...
- */
- if (count > (N_INT_BITS-1)) {
- RETURN (__mkSmallInteger(0));
- }
-
- RETURN ( __mkSmallInteger(bits >> count) );
- }
+ } else {
+ if (count == 0) {
+ RETURN (self);
+ }
+
+ /*
+ * right shifts cannot overflow
+ *
+ * some machines ignore shifts bigger than
+ * the number of bits in an int ...
+ */
+ if (count > (N_INT_BITS-1)) {
+ RETURN (__mkSmallInteger(0));
+ }
+
+ RETURN ( __mkSmallInteger(bits >> count) );
+ }
}
#endif /* not __SCHTEAM__ */
%}.
(shiftCount isMemberOf:SmallInteger) ifTrue:[
- ^ (LargeInteger value:self) rightShift:shiftCount
+ ^ (LargeInteger value:self) rightShift:shiftCount
].
^ self rightShift:shiftCount asInteger "/ is this a good idea ?
"
- 16 rightShift:2
+ 16 rightShift:2
-16 rightShift:2
-
- 4 rightShift:-2
- -4 rightShift:-2
+
+ 4 rightShift:-2
+ -4 rightShift:-2
"
"Modified: / 25-08-2017 / 12:30:42 / cg"
@@ -4253,7 +4253,7 @@
bernoulli
"returns the nth Bernoulli number.
The series runs this:
- 1, 1/2, 1/6, 0, -1/30, 0, 1/42, 0, -1/30, 0, 5/66, 0, -691/2730, etc
+ 1, 1/2, 1/6, 0, -1/30, 0, 1/42, 0, -1/30, 0, 5/66, 0, -691/2730, etc
Uses a table of the first 20 even bernoulli numbers.
So bernoulli(42) will fail for now.
@@ -4262,32 +4262,32 @@
|table p|
table := #(
- (1 6)
- (-1 30)
- (1 42)
- (-1 30)
- (5 66)
- (-691 2730)
- (7 6)
- (-3617 510)
- (43867 798)
- (-174611 330)
- (854513 138)
- (-236364091 2730)
- (8553103 6)
- (-23749461029 870)
- (8615841276005 14322)
- (-7709321041217 510)
- (2577687858367 6)
- (-26315271553053477373 1919190)
- (2929993913841559 6)
- (-261082718496449122051 13530)
- ).
+ (1 6)
+ (-1 30)
+ (1 42)
+ (-1 30)
+ (5 66)
+ (-691 2730)
+ (7 6)
+ (-3617 510)
+ (43867 798)
+ (-174611 330)
+ (854513 138)
+ (-236364091 2730)
+ (8553103 6)
+ (-23749461029 870)
+ (8615841276005 14322)
+ (-7709321041217 510)
+ (2577687858367 6)
+ (-26315271553053477373 1919190)
+ (2929993913841559 6)
+ (-261082718496449122051 13530)
+ ).
self even ifTrue:[
- self == 0 ifTrue:[^1].
- p := table at:(self / 2).
- ^ Fraction numerator:(p first) denominator:(p second).
+ self == 0 ifTrue:[^1].
+ p := table at:(self / 2).
+ ^ Fraction numerator:(p first) denominator:(p second).
].
self == 1 ifTrue:[ ^ (1 / 2) ].
^ 0.
@@ -4427,46 +4427,46 @@
(i.e. without log)."
self > 0 ifTrue:[
- self < 10000 ifTrue:[
- self < 10 ifTrue:[^ 0].
- self < 100 ifTrue:[^ 1].
- self < 1000 ifTrue:[^ 2].
- ^ 3
- ].
- self < 100000000 ifTrue:[
- self < 100000 ifTrue:[^ 4].
- self < 1000000 ifTrue:[^ 5].
- self < 10000000 ifTrue:[^ 6].
- ^ 7
- ].
- self < 1000000000 ifTrue:[^ 8].
-
- SmallInteger maxBytes == 4 ifTrue:[
- "/ on a 32 bit machine, SmallInt cannot be larger
- ^ 9
- ] ifFalse:[
- "/ 64 bit machine
- self < 100000000000000 ifTrue:[
- self < 10000000000 ifTrue:[^ 9].
- self < 100000000000 ifTrue:[^ 10].
- self < 1000000000000 ifTrue:[^ 11].
- self < 10000000000000 ifTrue:[^ 12].
- ^ 13
- ].
- self < 1000000000000000 ifTrue:[^ 14].
- self < 10000000000000000 ifTrue:[^ 15].
- self < 100000000000000000 ifTrue:[^ 16].
- self < 1000000000000000000 ifTrue:[^ 17].
- ^ 18.
- ].
+ self < 10000 ifTrue:[
+ self < 10 ifTrue:[^ 0].
+ self < 100 ifTrue:[^ 1].
+ self < 1000 ifTrue:[^ 2].
+ ^ 3
+ ].
+ self < 100000000 ifTrue:[
+ self < 100000 ifTrue:[^ 4].
+ self < 1000000 ifTrue:[^ 5].
+ self < 10000000 ifTrue:[^ 6].
+ ^ 7
+ ].
+ self < 1000000000 ifTrue:[^ 8].
+
+ SmallInteger maxBytes == 4 ifTrue:[
+ "/ on a 32 bit machine, SmallInt cannot be larger
+ ^ 9
+ ] ifFalse:[
+ "/ 64 bit machine
+ self < 100000000000000 ifTrue:[
+ self < 10000000000 ifTrue:[^ 9].
+ self < 100000000000 ifTrue:[^ 10].
+ self < 1000000000000 ifTrue:[^ 11].
+ self < 10000000000000 ifTrue:[^ 12].
+ ^ 13
+ ].
+ self < 1000000000000000 ifTrue:[^ 14].
+ self < 10000000000000000 ifTrue:[^ 15].
+ self < 100000000000000000 ifTrue:[^ 16].
+ self < 1000000000000000000 ifTrue:[^ 17].
+ ^ 18.
+ ].
].
^ self class
- raise:(self = 0 ifTrue:[#infiniteResultSignal] ifFalse:[#domainErrorSignal])
- receiver:self
- selector:#integerLog10
- arguments:#()
- errorString:'bad receiver in log10 (not strictly positive)'
+ raise:(self = 0 ifTrue:[#infiniteResultSignal] ifFalse:[#domainErrorSignal])
+ receiver:self
+ selector:#integerLog10
+ arguments:#()
+ errorString:'bad receiver in log10 (not strictly positive)'
"
99 integerLog10
@@ -4871,24 +4871,24 @@
int len;
if (__isStringLike(formatString)) {
- /*
- * actually only needed on sparc: since thisContext is
- * in a global register, which gets destroyed by printf,
- * manually save it here - very stupid ...
- */
- __BEGIN_PROTECT_REGISTERS__
-
- len = snprintf(buffer, sizeof(buffer), __stringVal(formatString), __intVal(self));
-
- __END_PROTECT_REGISTERS__
-
- if (len < 0) goto fail;
- if (len >= sizeof(buffer)) goto fail;
-
- s = __MKSTRING_L(buffer, len);
- if (s != nil) {
- RETURN (s);
- }
+ /*
+ * actually only needed on sparc: since thisContext is
+ * in a global register, which gets destroyed by printf,
+ * manually save it here - very stupid ...
+ */
+ __BEGIN_PROTECT_REGISTERS__
+
+ len = snprintf(buffer, sizeof(buffer), __stringVal(formatString), __intVal(self));
+
+ __END_PROTECT_REGISTERS__
+
+ if (len < 0) goto fail;
+ if (len >= sizeof(buffer)) goto fail;
+
+ s = __MKSTRING_L(buffer, len);
+ if (s != nil) {
+ RETURN (s);
+ }
}
fail: ;
#endif /* not __SCHTEAM__ */
@@ -4896,11 +4896,11 @@
^ super printfPrintString:formatString
"
- 123 printfPrintString:'%%d -> %d'
- 123 printfPrintString:'%%6d -> %6d'
- 123 printfPrintString:'%%x -> %x'
- 123 printfPrintString:'%%4x -> %4x'
- 123 printfPrintString:'%%04x -> %04x'
+ 123 printfPrintString:'%%d -> %d'
+ 123 printfPrintString:'%%6d -> %6d'
+ 123 printfPrintString:'%%x -> %x'
+ 123 printfPrintString:'%%4x -> %4x'
+ 123 printfPrintString:'%%04x -> %04x'
"
"Modified: / 03-07-2017 / 15:07:37 / cg"