--- a/Array.st Fri Sep 01 12:09:16 2000 +0200
+++ b/Array.st Fri Sep 01 12:11:39 2000 +0200
@@ -2084,117 +2084,117 @@
myClass = __qClass(self);
if ( __bothSmallInteger(start, stop) ) {
- index = __intVal(start) - 1;
- if (index >= 0) {
- nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
- index += nInsts;
- lastIndex = nInsts + __intVal(stop);
- nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
- if (nIndex < lastIndex) {
- lastIndex = nIndex;
- }
+ index = __intVal(start) - 1;
+ if (index >= 0) {
+ nInsts = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
+ index += nInsts;
+ lastIndex = nInsts + __intVal(stop);
+ nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
+ if (nIndex < lastIndex) {
+ lastIndex = nIndex;
+ }
- e = anElement;
+ e = anElement;
- if (e != nil) {
- /*
- * special kludge to search for a string;
- * this is so common, that its worth a special case
- */
+ if (e != nil) {
+ /*
+ * special kludge to search for a string;
+ * this is so common, that its worth a special case
+ */
#define SPECIAL_STRING_OPT
#ifdef SPECIAL_STRING_OPT
- if (__isString(e)) {
- while (index < lastIndex) {
- element = __InstPtr(self)->i_instvars[index++];
- if (__isNonNilObject(e)) {
- if (element == e) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- if (__qClass(element) == @global(String)) {
- if (strcmp(__stringVal(e), __stringVal(element)) == 0) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- } else {
- if ((*eq.ilc_func)(e, @symbol(=), nil,&eq, element) == true) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- /*
- * send of #= could have lead to a GC - refetch e
- */
- e = anElement;
- }
- }
- }
- RETURN (__MKSMALLINT(0));
- }
+ if (__isString(e)) {
+ while (index < lastIndex) {
+ element = __InstPtr(self)->i_instvars[index++];
+ if (__isNonNilObject(element)) {
+ if (element == e) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ if (__qClass(element) == @global(String)) {
+ if (strcmp(__stringVal(e), __stringVal(element)) == 0) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ } else {
+ if ((*eq.ilc_func)(e, @symbol(=), nil,&eq, element) == true) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ /*
+ * send of #= could have lead to a GC - refetch e
+ */
+ e = anElement;
+ }
+ }
+ }
+ RETURN (__MKSMALLINT(0));
+ }
#endif
- if (__isSmallInteger(e)) {
- /* search for a small number */
- while (index < lastIndex) {
- element = __InstPtr(self)->i_instvars[index++];
- if (element == e) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- if (!__isSmallInteger(element)) {
- if ((*eq.ilc_func)(e,
- @symbol(=),
- nil,&eq,
- element) == true) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- /*
- * send of #= could have lead to a GC - refetch e
- */
- e = anElement;
- }
- }
- RETURN (__MKSMALLINT(0));
- }
+ if (__isSmallInteger(e)) {
+ /* search for a small number */
+ while (index < lastIndex) {
+ element = __InstPtr(self)->i_instvars[index++];
+ if (element == e) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ if (!__isSmallInteger(element)) {
+ if ((*eq.ilc_func)(e,
+ @symbol(=),
+ nil,&eq,
+ element) == true) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ /*
+ * send of #= could have lead to a GC - refetch e
+ */
+ e = anElement;
+ }
+ }
+ RETURN (__MKSMALLINT(0));
+ }
- while (index < lastIndex) {
- element = __InstPtr(self)->i_instvars[index++];
- if (element != nil) {
- e = anElement;
- if ((element == e)
- || ((*eq.ilc_func)(e,
- @symbol(=),
- nil,&eq,
- element) == true)) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- }
- }
- } else {
- OBJ slf = self;
+ while (index < lastIndex) {
+ element = __InstPtr(self)->i_instvars[index++];
+ if (element != nil) {
+ e = anElement;
+ if ((element == e)
+ || ((*eq.ilc_func)(e,
+ @symbol(=),
+ nil,&eq,
+ element) == true)) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ }
+ }
+ } else {
+ OBJ slf = self;
- /*
- * search for nil - do an identity-search
- */
+ /*
+ * search for nil - do an identity-search
+ */
#if defined(UNROLL_LOOPS)
- {
- unsigned int i8;
+ {
+ unsigned int i8;
- while ((i8 = index + 8) < lastIndex) {
- if (__InstPtr(slf)->i_instvars[index] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 1) ); }
- if (__InstPtr(slf)->i_instvars[index+1] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 2) ); }
- if (__InstPtr(slf)->i_instvars[index+2] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 3) ); }
- if (__InstPtr(slf)->i_instvars[index+3] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 4) ); }
- if (__InstPtr(slf)->i_instvars[index+4] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 5) ); }
- if (__InstPtr(slf)->i_instvars[index+5] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 6) ); }
- if (__InstPtr(slf)->i_instvars[index+6] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 7) ); }
- if (__InstPtr(slf)->i_instvars[index+7] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 8) ); }
- index = i8;
- }
- }
+ while ((i8 = index + 8) < lastIndex) {
+ if (__InstPtr(slf)->i_instvars[index] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 1) ); }
+ if (__InstPtr(slf)->i_instvars[index+1] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 2) ); }
+ if (__InstPtr(slf)->i_instvars[index+2] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 3) ); }
+ if (__InstPtr(slf)->i_instvars[index+3] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 4) ); }
+ if (__InstPtr(slf)->i_instvars[index+4] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 5) ); }
+ if (__InstPtr(slf)->i_instvars[index+5] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 6) ); }
+ if (__InstPtr(slf)->i_instvars[index+6] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 7) ); }
+ if (__InstPtr(slf)->i_instvars[index+7] == nil) { RETURN ( __MKSMALLINT(index - nInsts + 8) ); }
+ index = i8;
+ }
+ }
#endif
- while (index < lastIndex) {
- if (__InstPtr(slf)->i_instvars[index++] == nil) {
- RETURN ( __MKSMALLINT(index - nInsts) );
- }
- }
- }
- }
- RETURN (__MKSMALLINT(0));
+ while (index < lastIndex) {
+ if (__InstPtr(slf)->i_instvars[index++] == nil) {
+ RETURN ( __MKSMALLINT(index - nInsts) );
+ }
+ }
+ }
+ }
+ RETURN (__MKSMALLINT(0));
}
%}.
^ super indexOf:anElement startingAt:start endingAt:stop
@@ -2415,5 +2415,5 @@
!Array class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.128 2000-08-22 13:55:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.129 2000-09-01 10:11:39 cg Exp $'
! !