SmallInteger.st
changeset 18760 9b0b0c157e4c
parent 18699 24b9c15dc6aa
child 18765 c4a2ea753acc
child 18815 085878786453
--- a/SmallInteger.st	Tue Sep 22 00:53:07 2015 +0200
+++ b/SmallInteger.st	Wed Sep 23 18:16:53 2015 +0200
@@ -2880,6 +2880,7 @@
     ^ self
 ! !
 
+
 !SmallInteger methodsFor:'iteration'!
 
 timesRepeat:aBlock
@@ -4902,19 +4903,24 @@
 
 %{  /* NOCONTEXT */
 #ifndef __SCHTEAM__
-
+# if TAG_INT <= 1 /* tag in low bit */
+    RETURN ( __mkSmallInteger( (((INT)self) > TAG_INT) - (((INT)self) < 0) ) );
+# else
     INT val = __intVal(self);
 
-    if (val < 0) {
-	RETURN ( __mkSmallInteger(-1) );
-    }
-    if (val > 0) {
-	RETURN ( __mkSmallInteger(1) );
-    }
-    RETURN ( __mkSmallInteger(0) );
+    RETURN ( __mkSmallInteger( (val > 0) - (val < 0) ) );
+# endif
 #endif
 %}.
     ^ super sign
+
+    "
+     -5 sign
+     -1 sign
+     0 sign
+     1 sign
+     5 sign
+    "
 !
 
 strictlyPositive