--- a/Array.st Fri Mar 03 09:22:00 2017 +0100
+++ b/Array.st Fri Mar 03 16:21:23 2017 +0100
@@ -521,8 +521,8 @@
, aCollection
%{
- if (__isArray(aCollection)) {
- if (__isArray(self)) {
+ if (__isArrayLike(aCollection)) {
+ if (__isArrayLike(self)) {
OBJ newArray;
int mySize = __arraySize(self);
int otherSize = __arraySize(aCollection);
@@ -2023,93 +2023,93 @@
INT nInsts;
if (__isSmallInteger(start)) {
- index = __intVal(start) - 1;
- if (index >= 0) {
- nInsts = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
- index += nInsts;
- nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
- el = anElement;
- op = & (__InstPtr(self)->i_instvars[index]);
+ index = __intVal(start) - 1;
+ if (index >= 0) {
+ nInsts = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
+ index += nInsts;
+ nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
+ el = anElement;
+ op = & (__InstPtr(self)->i_instvars[index]);
#if defined(memsrch4)
- if (index < nIndex) {
- OBJ *p;
+ if (index < nIndex) {
+ OBJ *p;
- p = memsrch4(op, (INT)el, (nIndex - index));
- if (p) {
- index += (p - op + 1);
- RETURN ( __mkSmallInteger(index) );
- }
- }
+ p = memsrch4(op, (INT)el, (nIndex - index));
+ if (p) {
+ index += (p - op + 1);
+ RETURN ( __mkSmallInteger(index) );
+ }
+ }
#else
# ifdef __UNROLL_LOOPS__
- {
- /*
- * don't argue about those gotos below - they speed up that thing by 30%;
- * its better to exit the loops below with a goto,
- * since the generated code will then be:
- * compare
- * branch-on-equal found
- *
- * otherwise (with ret as if-statement), we get:
- * compare
- * branch-on-not-equal skipLabel
- * move-to-ret-register true
- * goto ret-label
- * skipLabel
- *
- * therefore, WITH the so-much-blamed goto, we only branch
- * when found; without the goto, we branch always.
- * Pipelined CPUs do usually not like taken branches.
- */
+ {
+ /*
+ * don't argue about those gotos below - they speed up that thing by 30%;
+ * its better to exit the loops below with a goto,
+ * since the generated code will then be:
+ * compare
+ * branch-on-equal found
+ *
+ * otherwise (with ret as if-statement), we get:
+ * compare
+ * branch-on-not-equal skipLabel
+ * move-to-ret-register true
+ * goto ret-label
+ * skipLabel
+ *
+ * therefore, WITH the so-much-blamed goto, we only branch
+ * when found; without the goto, we branch always.
+ * Pipelined CPUs do usually not like taken branches.
+ */
- unsigned INT i8;
+ unsigned INT i8;
- while ((i8 = index + 8) < nIndex) {
- if (op[0] == el) goto found1;
- if (op[1] == el) goto found2;
- if (op[2] == el) goto found3;
- if (op[3] == el) goto found4;
- if (op[4] == el) goto found5;
- if (op[5] == el) goto found6;
- if (op[6] == el) goto found7;
- if (op[7] == el) goto found8;
- index = i8;
- op += 8;
- }
- if (0) {
- found1:
- RETURN ( __mkSmallInteger(index + 1 - nInsts) );
- found2:
- RETURN ( __mkSmallInteger(index + 2 - nInsts) );
- found3:
- RETURN ( __mkSmallInteger(index + 3 - nInsts) );
- found4:
- RETURN ( __mkSmallInteger(index + 4 - nInsts) );
- found5:
- RETURN ( __mkSmallInteger(index + 5 - nInsts) );
- found6:
- RETURN ( __mkSmallInteger(index + 6 - nInsts) );
- found7:
- RETURN ( __mkSmallInteger(index + 7 - nInsts) );
- found8:
- RETURN ( __mkSmallInteger(index + 8 - nInsts) );
- }
- }
+ while ((i8 = index + 8) < nIndex) {
+ if (op[0] == el) goto found1;
+ if (op[1] == el) goto found2;
+ if (op[2] == el) goto found3;
+ if (op[3] == el) goto found4;
+ if (op[4] == el) goto found5;
+ if (op[5] == el) goto found6;
+ if (op[6] == el) goto found7;
+ if (op[7] == el) goto found8;
+ index = i8;
+ op += 8;
+ }
+ if (0) {
+ found1:
+ RETURN ( __mkSmallInteger(index + 1 - nInsts) );
+ found2:
+ RETURN ( __mkSmallInteger(index + 2 - nInsts) );
+ found3:
+ RETURN ( __mkSmallInteger(index + 3 - nInsts) );
+ found4:
+ RETURN ( __mkSmallInteger(index + 4 - nInsts) );
+ found5:
+ RETURN ( __mkSmallInteger(index + 5 - nInsts) );
+ found6:
+ RETURN ( __mkSmallInteger(index + 6 - nInsts) );
+ found7:
+ RETURN ( __mkSmallInteger(index + 7 - nInsts) );
+ found8:
+ RETURN ( __mkSmallInteger(index + 8 - nInsts) );
+ }
+ }
# endif /* __UNROLLED_LOOPS__ */
- while (index++ < nIndex) {
- if (*op++ == el) goto found0;
- }
+ while (index++ < nIndex) {
+ if (*op++ == el) goto found0;
+ }
- if (0) {
- found0:
- RETURN ( __mkSmallInteger(index - nInsts) );
- }
+ if (0) {
+ found0:
+ RETURN ( __mkSmallInteger(index - nInsts) );
+ }
#endif /* no memsrch */
- }
- RETURN ( __mkSmallInteger(0) );
+ }
+ RETURN ( __mkSmallInteger(0) );
}
%}.
^ super identityIndexOf:anElement startingAt:start
@@ -2519,18 +2519,18 @@
* (except if searching for nil - there is no need for equal compare ...)
*/
if (nIndex > 500) {
- if (o != nil)
- nIndex = 500;
+ if (o != nil)
+ nIndex = 500;
}
# ifdef memsrch4
if (index < nIndex) {
- OBJ *p;
+ OBJ *p;
- p = memsrch4(&(__InstPtr(self)->i_instvars[index]), (INT)o, (nIndex - index));
- if (p) {
- RETURN ( true );
- }
+ p = memsrch4(&(__InstPtr(self)->i_instvars[index]), (INT)o, (nIndex - index));
+ if (p) {
+ RETURN ( true );
+ }
}
# else
@@ -2556,35 +2556,35 @@
*/
# ifdef __UNROLL_LOOPS__
{
- unsigned INT i8;
- REGISTER OBJ slf = self;
+ unsigned INT i8;
+ REGISTER OBJ slf = self;
- while ((i8 = index + 8) < nIndex) {
- if (__InstPtr(slf)->i_instvars[index] == o) goto found;
- if (__InstPtr(slf)->i_instvars[index+1] == o) goto found;
- if (__InstPtr(slf)->i_instvars[index+2] == o) goto found;
- if (__InstPtr(slf)->i_instvars[index+3] == o) goto found;
- if (__InstPtr(slf)->i_instvars[index+4] == o) goto found;
- if (__InstPtr(slf)->i_instvars[index+5] == o) goto found;
- if (__InstPtr(slf)->i_instvars[index+6] == o) goto found;
- if (__InstPtr(slf)->i_instvars[index+7] == o) goto found;
- index = i8;
- }
+ while ((i8 = index + 8) < nIndex) {
+ if (__InstPtr(slf)->i_instvars[index] == o) goto found;
+ if (__InstPtr(slf)->i_instvars[index+1] == o) goto found;
+ if (__InstPtr(slf)->i_instvars[index+2] == o) goto found;
+ if (__InstPtr(slf)->i_instvars[index+3] == o) goto found;
+ if (__InstPtr(slf)->i_instvars[index+4] == o) goto found;
+ if (__InstPtr(slf)->i_instvars[index+5] == o) goto found;
+ if (__InstPtr(slf)->i_instvars[index+6] == o) goto found;
+ if (__InstPtr(slf)->i_instvars[index+7] == o) goto found;
+ index = i8;
+ }
}
# endif /* __UNROLL_LOOPS__ */
while (index < nIndex) {
- if (__InstPtr(self)->i_instvars[index++] == o) goto found;
+ if (__InstPtr(self)->i_instvars[index++] == o) goto found;
}
if (0) {
- found:
- RETURN (true);
+ found:
+ RETURN (true);
}
# endif /* no memsrch */
if (o == nil) {
- RETURN ( false );
+ RETURN ( false );
}
%}.
@@ -2605,15 +2605,15 @@
index = __intVal(__ClassInstPtr(__qClass(self))->c_ninstvars);
while (index < nIndex) {
- element = __InstPtr(self)->i_instvars[index++];
- if (element != nil) {
- if ((*eq.ilc_func)(anObject,
- @symbol(=),
- nil,&eq,
- element)==true) {
- RETURN ( true );
- }
- }
+ element = __InstPtr(self)->i_instvars[index++];
+ if (element != nil) {
+ if ((*eq.ilc_func)(anObject,
+ @symbol(=),
+ nil,&eq,
+ element)==true) {
+ RETURN ( true );
+ }
+ }
}
RETURN (false);
%}.
@@ -2647,7 +2647,7 @@
%{ /* NOCONTEXT */
if (__isArrayLike(self)) {
- RETURN ( (__arraySize(self) == 0) ? true : false);
+ RETURN ( (__arraySize(self) == 0) ? true : false);
}
%}.
^ self size == 0
@@ -2661,7 +2661,7 @@
%{ /* NOCONTEXT */
if (__isArrayLike(self)) {
- RETURN ( (__arraySize(self) == 0) ? true : false);
+ RETURN ( (__arraySize(self) == 0) ? true : false);
}
%}.
^ self size == 0
@@ -2693,7 +2693,7 @@
%{ /* NOCONTEXT */
if (__isArrayLike(self)) {
- RETURN ( (__arraySize(self) != 0) ? true : false);
+ RETURN ( (__arraySize(self) != 0) ? true : false);
}
%}.
^ self size ~~ 0
@@ -2707,7 +2707,7 @@
%{ /* NOCONTEXT */
if (__isArrayLike(self)) {
- RETURN ( (__arraySize(self) != 0) ? true : false);
+ RETURN ( (__arraySize(self) != 0) ? true : false);
}
%}.
^ self size ~~ 0
@@ -2734,4 +2734,3 @@
version_CVS
^ '$Header$'
! !
-