SmallInteger.st
changeset 18904 1c2c3d3d381e
parent 18898 0dc54d84ac92
child 18907 77e711d30041
child 18945 7bc762b80ff6
--- a/SmallInteger.st	Tue Nov 17 20:53:56 2015 +0100
+++ b/SmallInteger.st	Tue Nov 17 21:07:57 2015 +0100
@@ -1079,7 +1079,7 @@
     _v1 = (_v1 & 0x33333333) + ((_v1 >> 2) & 0x33333333);
     _v1 = ((_v1 + (_v1 >> 4)) & 0x0F0F0F0F);
 
-    _v2 = (unsigned int)(_self >> 32);
+    _v2 = (_self >> 32) & 0xFFFFFFFF;
     _v2 = _v2 - ((_v2 >> 1) & 0x55555555);
     _v2 = (_v2 & 0x33333333) + ((_v2 >> 2) & 0x33333333);
     _v2 = ((_v2 + (_v2 >> 4)) & 0x0F0F0F0F);
@@ -5067,9 +5067,12 @@
     "return true, if the receiver is even"
 
 %{  /* NOCONTEXT */
-#ifndef __SCHTEAM__
+#ifdef __SCHTEAM__
+    return __c__._RETURN( self.isEven() ? STObject.True : STObject.False );
+    /* NOTREACHED */
+#else
     RETURN ( ((INT)self & (INT)__MASKSMALLINT(1)) ? false : true );
-#endif
+#endif /* not SCHTEAM */
 %}.
     ^ super even
 !
@@ -5104,7 +5107,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN( self.ltP(0) );
+    return context._RETURN( self.isLt_0() ? STObject.True : STObject.False);
     /* NOTREACHED */
 #else
 # if TAG_INT == 1
@@ -5120,7 +5123,8 @@
 
 nextPowerOf2
     "return the power of 2 at or above the receiver.
-     Useful for padding."
+     Useful for padding.
+     Notice, that for a powerOf2, the receiver is returned."
 
 %{  /* NOCONTEXT */
 #ifndef __SCHTEAM__
@@ -5141,6 +5145,7 @@
     ^ super nextPowerOf2
 
     "
+     0 nextPowerOf2
      1 nextPowerOf2
      2 nextPowerOf2
      3 nextPowerOf2
@@ -5161,12 +5166,14 @@
     "return true, if the receiver is odd"
 
 %{  /* NOCONTEXT */
-#ifndef __SCHTEAM__
+#ifdef __SCHTEAM__
+    return __c__._RETURN( self.isEven() ? STObject.False : STObject.True );
+    /* NOTREACHED */
+#else
     RETURN ( ((INT)self & (INT)__MASKSMALLINT(1)) ? true : false );
 #endif
 %}.
     ^ super odd
-
 !
 
 parityOdd
@@ -5218,7 +5225,8 @@
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
-    return context._RETURN( (self.ltP(0) == STObject.True) ? STObject.False : STObject.True);
+    return context._RETURN( self.isGe_0() ? STObject.True : STObject.False);
+    /* NOTREACHED */
 #else
 
 # if TAG_INT == 1
@@ -5263,7 +5271,10 @@
      reimplemented here for speed"
 
 %{  /* NOCONTEXT */
-#ifndef __SCHTEAM__
+#ifdef __SCHTEAM__
+    return context._RETURN( self.isGt_0() ? STObject.True : STObject.False);
+    /* NOTREACHED */
+#else
 
 # if TAG_INT == 1
     /* tag bit does not change sign */