Array.st
branchjv
changeset 18292 8d4fe353a2d2
parent 18274 042d13555f1f
parent 18289 9d906f0b71eb
child 18315 e678ab267382
--- a/Array.st	Sat Apr 25 06:43:41 2015 +0200
+++ b/Array.st	Mon Apr 27 06:43:29 2015 +0200
@@ -313,7 +313,11 @@
      This method is the same as basicAt:."
 
 %{  /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+    if (index.isSmallInteger()) {
+	return context._RETURN( self.basicAt(index.intValue() ));
+    }
+#else
     REGISTER INT indx;
     REGISTER OBJ slf;
     REGISTER unsigned INT nIndex;
@@ -336,6 +340,7 @@
 	goto fetch;
     }
 badIndex: ;
+#endif /* not SCHTEAM */
 %}.
 "/    ^ super at:index
     ^ super basicAt:index   "/ knowing that super-#at: does #basicAt:
@@ -350,6 +355,12 @@
      This method is the same as basicAt:put:."
 
 %{  /* NOCONTEXT */
+#ifdef __SCHTEAM__
+    if (index.isSmallInteger()) {
+	self.basicAt_put(index.intValue(), anObject);
+	return context._RETURN( anObject );
+    }
+#else
 
     REGISTER INT indx;
     REGISTER OBJ slf;
@@ -375,6 +386,7 @@
 	goto store;
     }
 badIndex: ;
+#endif /* not SCHTEAM */
 %}.
 "/    ^ super at:index put:anObject
     ^ super basicAt:index put:anObject  "/ knowing that super-#at:put: does #basicAt:put:
@@ -387,6 +399,11 @@
      - added here for speed"
 
 %{  /* NOCONTEXT */
+#ifdef __SCHTEAM__
+    if (index.isSmallInteger()) {
+	return context._RETURN( self.basicAt(index.intValue() ));
+    }
+#else
 
     REGISTER INT indx;
     REGISTER OBJ slf;
@@ -407,6 +424,7 @@
 	}
     }
 badIndex: ;
+#endif /* not SCHTEAM */
 %}.
     ^ super basicAt:index
 !
@@ -417,7 +435,12 @@
      - added here for speed"
 
 %{  /* NOCONTEXT */
-
+#ifdef __SCHTEAM__
+    if (index.isSmallInteger()) {
+	self.basicAt_put(index.intValue(), anObject);
+	return context._RETURN( anObject );
+    }
+#else
     REGISTER INT indx;
     REGISTER OBJ slf;
     REGISTER unsigned INT nIndex;
@@ -439,6 +462,7 @@
 	}
     }
 badIndex: ;
+#endif /* not SCHTEAM */
 %}.
     ^ super basicAt:index put:anObject
 
@@ -1749,50 +1773,50 @@
     "append a printed representation of the receiver to aStream"
 
     self isLiteral ifTrue:[
-        |limit firstOne s|
+	|limit firstOne s|
 
-        thisContext isRecursive ifTrue:[
-            'Array [error]: printOn: of self referencing collection.' errorPrintCR.
-            aStream nextPutAll:'#("recursive")'.
-            ^ self
-        ].
+	thisContext isRecursive ifTrue:[
+	    'Array [error]: printOn: of self referencing collection.' errorPrintCR.
+	    aStream nextPutAll:'#("recursive")'.
+	    ^ self
+	].
 
-        aStream nextPutAll:'#('.
-        firstOne := true.
+	aStream nextPutAll:'#('.
+	firstOne := true.
 
-        "
-         if aStream is not positionable, create an temporary positionable stream
-         (needed for limit calculation)
-        "
-        aStream isPositionable ifTrue:[
-            s := aStream.
-        ] ifFalse:[
-            s := CharacterWriteStream new:50.
-        ].
-        limit := s position + self maxPrint.
+	"
+	 if aStream is not positionable, create an temporary positionable stream
+	 (needed for limit calculation)
+	"
+	aStream isPositionable ifTrue:[
+	    s := aStream.
+	] ifFalse:[
+	    s := CharacterWriteStream new:50.
+	].
+	limit := s position + self maxPrint.
 
-        self printElementsDo:[:element |
-            firstOne ifFalse:[
-                s space
-            ] ifTrue:[
-                firstOne := false
-            ].
-            (s position >= limit) ifTrue:[
-                s ~~ aStream ifTrue:[
-                    aStream nextPutAll:(s contents).
-                ].
-                aStream nextPutAll:'...etc...)'.
-                ^ self
-            ] ifFalse:[
-                element printOn:s.
-            ].
-        ].
-        s ~~ aStream ifTrue:[
-            aStream nextPutAll:(s contents).
-        ].
-        aStream nextPut:$)
+	self printElementsDo:[:element |
+	    firstOne ifFalse:[
+		s space
+	    ] ifTrue:[
+		firstOne := false
+	    ].
+	    (s position >= limit) ifTrue:[
+		s ~~ aStream ifTrue:[
+		    aStream nextPutAll:(s contents).
+		].
+		aStream nextPutAll:'...etc...)'.
+		^ self
+	    ] ifFalse:[
+		element printOn:s.
+	    ].
+	].
+	s ~~ aStream ifTrue:[
+	    aStream nextPutAll:(s contents).
+	].
+	aStream nextPut:$)
     ] ifFalse:[
-        super printOn:aStream
+	super printOn:aStream
     ]
 
     "
@@ -2648,10 +2672,10 @@
 !Array class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.167 2015-04-22 17:27:19 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.169 2015-04-26 11:30:22 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.167 2015-04-22 17:27:19 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.169 2015-04-26 11:30:22 cg Exp $'
 ! !