borland has no long long
authorClaus Gittinger <cg@exept.de>
Mon, 11 Mar 2019 11:43:42 +0100
changeset 23862 089a1789a72a
parent 23861 b528f6139ea8
child 23863 b866297924c8
borland has no long long
String.st
--- a/String.st	Sat Mar 09 20:56:55 2019 +0100
+++ b/String.st	Mon Mar 11 11:43:42 2019 +0100
@@ -188,116 +188,116 @@
     int nInstVars;
 
     if (__isSmallInteger(anInteger)) {
-        len = __intVal(anInteger);
-        if (len >= 0) {
-            instsize = OHDR_SIZE + len + 1;
-            if (self == String || self == ImmutableString) {
-                if (__CanDoQuickNew(instsize)) {        /* OBJECT ALLOCATION */
-                    /*
-                     * the most common case
-                     */
-                    __qCheckedNew(newString, instsize);
-                    __InstPtr(newString)->o_class = self; /* no need for PROTECT - there was no GC */
-                    __qSTORE(newString, self);
-
-                    cp = __stringVal(newString);
+	len = __intVal(anInteger);
+	if (len >= 0) {
+	    instsize = OHDR_SIZE + len + 1;
+	    if (self == String || self == ImmutableString) {
+		if (__CanDoQuickNew(instsize)) {        /* OBJECT ALLOCATION */
+		    /*
+		     * the most common case
+		     */
+		    __qCheckedNew(newString, instsize);
+		    __InstPtr(newString)->o_class = self; /* no need for PROTECT - there was no GC */
+		    __qSTORE(newString, self);
+
+		    cp = __stringVal(newString);
 
 # if defined(memset4)
-                    {
-                        /*
-                         * no sizeof(int) here please -
-                         * - memset4 (if defined) fills 4-bytes on ALL machines
-                         */
-                        int l4 = len >> 2;
-
-                        if (len & 3) l4++;
-                        memset4(cp, 0x20202020, l4);
-                        cp[len] = '\0';
-                    }
+		    {
+			/*
+			 * no sizeof(int) here please -
+			 * - memset4 (if defined) fills 4-bytes on ALL machines
+			 */
+			int l4 = len >> 2;
+
+			if (len & 3) l4++;
+			memset4(cp, 0x20202020, l4);
+			cp[len] = '\0';
+		    }
 # else
 #  ifdef FAST_MEMSET
-                    memset(cp, ' ', len);
-                    cp[len] = '\0';
+		    memset(cp, ' ', len);
+		    cp[len] = '\0';
 #  else
-                    for ( ; len >= 8; cp += 8, len -= 8) {
+		    for ( ; len >= 8; cp += 8, len -= 8) {
 #   ifdef INT64
-                        ((INT64 *)cp)[0] = 0x2020202020202020L;
+			((INT64 *)cp)[0] = 0x2020202020202020L;
 #   else
-                        ((int *)cp)[0] = 0x20202020;
-                        ((int *)cp)[1] = 0x20202020;
+			((int *)cp)[0] = 0x20202020;
+			((int *)cp)[1] = 0x20202020;
 #   endif
-                    }
-                    while (len--)
-                        *cp++ = ' ';
-                    *cp = '\0';
+		    }
+		    while (len--)
+			*cp++ = ' ';
+		    *cp = '\0';
 #  endif /* not FAST_MEMSET */
 # endif /* not memset4 */
 
-                    RETURN (newString);
-                }
-                nInstVars = 0;
-            } else {
-                nInstVars = __intVal(__ClassInstPtr(self)->c_ninstvars);
-                instsize += __OBJS2BYTES__(nInstVars);
-            }
-
-            __PROTECT_CONTEXT__;
-            __qNew(newString, instsize);        /* OBJECT ALLOCATION */
-            __UNPROTECT_CONTEXT__;
-
-            if (newString == nil) goto fail;
-
-            __InstPtr(newString)->o_class = self;
-            __qSTORE(newString, self);
-
-            cp = __stringVal(newString);
-            if (nInstVars) {
-                OBJ *op;
-                cp += __OBJS2BYTES__(nInstVars);
-
-                /*
-                 * nil-out instvars
-                 */
+		    RETURN (newString);
+		}
+		nInstVars = 0;
+	    } else {
+		nInstVars = __intVal(__ClassInstPtr(self)->c_ninstvars);
+		instsize += __OBJS2BYTES__(nInstVars);
+	    }
+
+	    __PROTECT_CONTEXT__;
+	    __qNew(newString, instsize);        /* OBJECT ALLOCATION */
+	    __UNPROTECT_CONTEXT__;
+
+	    if (newString == nil) goto fail;
+
+	    __InstPtr(newString)->o_class = self;
+	    __qSTORE(newString, self);
+
+	    cp = __stringVal(newString);
+	    if (nInstVars) {
+		OBJ *op;
+		cp += __OBJS2BYTES__(nInstVars);
+
+		/*
+		 * nil-out instvars
+		 */
 # if defined(memset4)
-                memset4(__InstPtr(newString)->i_instvars, nil, nInstVars);
+		memset4(__InstPtr(newString)->i_instvars, nil, nInstVars);
 # else
 #  if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
-                /*
-                 * knowing that nil is 0
-                 */
-                memset(__InstPtr(newString)->i_instvars, 0, __OBJS2BYTES__(nInstVars));
+		/*
+		 * knowing that nil is 0
+		 */
+		memset(__InstPtr(newString)->i_instvars, 0, __OBJS2BYTES__(nInstVars));
 #  else
-                op = __InstPtr(newString)->i_instvars;
-                do {
-                    *op++ = nil;
-                } while (--nInstVars);
+		op = __InstPtr(newString)->i_instvars;
+		do {
+		    *op++ = nil;
+		} while (--nInstVars);
 #  endif  /* !FAST_MEMSET */
 # endif
-            }
-
-            /*
-             * fill with spaces
-             */
+	    }
+
+	    /*
+	     * fill with spaces
+	     */
 # ifdef FAST_MEMSET
-            memset(cp, ' ', len);
-            *(cp + len) = '\0';
+	    memset(cp, ' ', len);
+	    *(cp + len) = '\0';
 # else
-            while (len >= 8) {
+	    while (len >= 8) {
 #  ifdef INT64
-                ((INT64 *)cp)[0] = 0x2020202020202020L;
+		((INT64 *)cp)[0] = 0x2020202020202020L;
 #  else
-                ((int *)cp)[0] = 0x20202020;
-                ((int *)cp)[1] = 0x20202020;
+		((int *)cp)[0] = 0x20202020;
+		((int *)cp)[1] = 0x20202020;
 #  endif
-                cp += 8;
-                len -= 8;
-            }
-            while (len--)
-                *cp++ = ' ';
-            *cp = '\0';
+		cp += 8;
+		len -= 8;
+	    }
+	    while (len--)
+		*cp++ = ' ';
+	    *cp = '\0';
 # endif /* !FAST_MEMSET */
-            RETURN (newString);
-        }
+	    RETURN (newString);
+	}
     }
 fail: ;;
 #endif /* not __SCHTEAM__ */
@@ -307,11 +307,11 @@
      use error handling in superclass
     "
     (anInteger < 0) ifTrue:[
-        "
-         the argument is negative,
-        "
-        self argumentError:'bad (negative) argument to new:' with:anInteger.
-        ^ nil
+	"
+	 the argument is negative,
+	"
+	self argumentError:'bad (negative) argument to new:' with:anInteger.
+	^ nil
     ].
 
     ^ (super basicNew:anInteger+1) atAllPut:(Character space)
@@ -374,64 +374,64 @@
     int nInstVars, instsize;
 
     if (__isSmallInteger(anInteger)) {
-        len = __intVal(anInteger);
-        if (len >= 0) {
-            instsize = OHDR_SIZE + len + 1;
-            if (self == String) {
-                if (__CanDoQuickNew(instsize)) {        /* OBJECT ALLOCATION */
-                    /*
-                     * the most common case
-                     */
-                    __qCheckedNew(newString, instsize);
-                    __InstPtr(newString)->o_class = self; /* no need for PROTECT - there was no GC */
-                    __qSTORE(newString, self);
-
-                    cp = __stringVal(newString);
-                    cp[len] = '\0';
-                    RETURN (newString);
-                }
-                nInstVars = 0;
-            } else {
-                nInstVars = __intVal(__ClassInstPtr(self)->c_ninstvars);
-                instsize += __OBJS2BYTES__(nInstVars);
-            }
-
-            __PROTECT_CONTEXT__;
-            __qNew(newString, instsize);        /* OBJECT ALLOCATION */
-            __UNPROTECT_CONTEXT__;
-
-            if (newString == nil) goto fail;
-
-            __InstPtr(newString)->o_class = self;
-            __qSTORE(newString, self);
-
-            if (nInstVars) {
-                /*
-                 * nil-out instvars
-                 */
+	len = __intVal(anInteger);
+	if (len >= 0) {
+	    instsize = OHDR_SIZE + len + 1;
+	    if (self == String) {
+		if (__CanDoQuickNew(instsize)) {        /* OBJECT ALLOCATION */
+		    /*
+		     * the most common case
+		     */
+		    __qCheckedNew(newString, instsize);
+		    __InstPtr(newString)->o_class = self; /* no need for PROTECT - there was no GC */
+		    __qSTORE(newString, self);
+
+		    cp = __stringVal(newString);
+		    cp[len] = '\0';
+		    RETURN (newString);
+		}
+		nInstVars = 0;
+	    } else {
+		nInstVars = __intVal(__ClassInstPtr(self)->c_ninstvars);
+		instsize += __OBJS2BYTES__(nInstVars);
+	    }
+
+	    __PROTECT_CONTEXT__;
+	    __qNew(newString, instsize);        /* OBJECT ALLOCATION */
+	    __UNPROTECT_CONTEXT__;
+
+	    if (newString == nil) goto fail;
+
+	    __InstPtr(newString)->o_class = self;
+	    __qSTORE(newString, self);
+
+	    if (nInstVars) {
+		/*
+		 * nil-out instvars
+		 */
 # if defined(memset4)
-                memset4(__InstPtr(newString)->i_instvars, nil, nInstVars);
+		memset4(__InstPtr(newString)->i_instvars, nil, nInstVars);
 # else
 #  if defined(FAST_MEMSET) && ! defined(NEGATIVE_ADDRESSES)
-                /*
-                 * knowing that nil is 0
-                 */
-                memset(__InstPtr(newString)->i_instvars, 0, __OBJS2BYTES__(nInstVars));
+		/*
+		 * knowing that nil is 0
+		 */
+		memset(__InstPtr(newString)->i_instvars, 0, __OBJS2BYTES__(nInstVars));
 #  else
-                op = __InstPtr(newString)->i_instvars;
-                do {
-                    *op++ = nil;
-                } while (--nInstVars);
+		op = __InstPtr(newString)->i_instvars;
+		do {
+		    *op++ = nil;
+		} while (--nInstVars);
 #  endif
 # endif
-                cp = __stringVal(newString) + __OBJS2BYTES__(nInstVars);
-            } else {
-                cp = __stringVal(newString);
-            }
-
-            *(cp + len) = '\0';
-            RETURN (newString);
-        }
+		cp = __stringVal(newString) + __OBJS2BYTES__(nInstVars);
+	    } else {
+		cp = __stringVal(newString);
+	    }
+
+	    *(cp + len) = '\0';
+	    RETURN (newString);
+	}
     }
 fail: ;;
 #endif /* not __SCHTEAM__ */
@@ -441,11 +441,11 @@
      use error handling in superclass
     "
     (anInteger < 0) ifTrue:[
-        "
-         the argument is negative,
-        "
-        self argumentError:'bad (negative) argument to new:' with:anInteger.
-        ^ nil
+	"
+	 the argument is negative,
+	"
+	self argumentError:'bad (negative) argument to new:' with:anInteger.
+	^ nil
     ].
 
     ^ self basicNew:anInteger
@@ -1473,27 +1473,27 @@
 
     index = __intVal(start);
     if (index <= 0) {
-        index = 1;
+	index = 1;
     }
     len = __stringSize(self);
     cp = __stringVal(self);
     if ((cls = __qClass(self)) != String) {
-        int numInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-
-        cp += numInstBytes;
-        len -= numInstBytes;
+	int numInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+
+	cp += numInstBytes;
+	len -= numInstBytes;
     }
     while (index <= len) {
-        REGISTER unsigned char c;
-
-        c = cp[index - 1];
-        if (c > ' ') {
-            if ((c != ' ') && (c != '\t') && (c != '\n')
-             && (c != '\r') && (c != '\f')) {
-                RETURN ( __mkSmallInteger(index) );
-            }
-        }
-        index++;
+	REGISTER unsigned char c;
+
+	c = cp[index - 1];
+	if (c > ' ') {
+	    if ((c != ' ') && (c != '\t') && (c != '\n')
+	     && (c != '\r') && (c != '\f')) {
+		RETURN ( __mkSmallInteger(index) );
+	    }
+	}
+	index++;
     }
     RETURN ( __mkSmallInteger(0) );
 %}.
@@ -1513,97 +1513,97 @@
 %{  /* NOCONTEXT */
 
     if (__isSmallInteger(start)) {
-        REGISTER unsigned char *cp;
-        int len, index;
-        OBJ cls;
-
-        index = __intVal(start)-1;
-        // is this a good idea?
-        if (index < 0) {
-            index = 0;
-        }
-        len = __stringSize(self);
-        cp = __stringVal(self);
-
-        // care for subclasses of string
-        if ((cls = __qClass(self)) != String) {
-            int numInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-
-            cp += numInstBytes;
-            len -= numInstBytes;
-        }
-
-        // these pre-loops do fast skip over non-separators
-        // (anything above 0x32)
+	REGISTER unsigned char *cp;
+	int len, index;
+	OBJ cls;
+
+	index = __intVal(start)-1;
+	// is this a good idea?
+	if (index < 0) {
+	    index = 0;
+	}
+	len = __stringSize(self);
+	cp = __stringVal(self);
+
+	// care for subclasses of string
+	if ((cls = __qClass(self)) != String) {
+	    int numInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+
+	    cp += numInstBytes;
+	    len -= numInstBytes;
+	}
+
+	// these pre-loops do fast skip over non-separators
+	// (anything above 0x32)
 #if __POINTER_SIZE__ == 8
-        if ((index & 7) == 0) {
-            int len8 = len-8;
-            while (index < len8) {
-                REGISTER unsigned INT eightChars;
-                REGISTER unsigned INT eightCharsMasked;
-
-                eightChars = ((unsigned INT *)(cp+index))[0];
-                eightCharsMasked = eightChars & 0xE0E0E0E0E0E0E0E0ULL;
-
-                // any control char?
-                // (these are 0..31 and also the space);
-                // so we need two compares.
+	if ((index & 7) == 0) {
+	    int len8 = len-8;
+	    while (index < len8) {
+		REGISTER unsigned INT eightChars;
+		REGISTER unsigned INT eightCharsMasked;
+
+		eightChars = ((unsigned INT *)(cp+index))[0];
+		eightCharsMasked = eightChars & 0xE0E0E0E0E0E0E0E0ULL;
+
+		// any control char?
+		// (these are 0..31 and also the space);
+		// so we need two compares.
 #               define hasZeroByte(v) (((v) - 0x0101010101010101ULL) & ~(v) & 0x8080808080808080ULL)
 #               define hasByteM(v,m)   hasZeroByte( (v) ^ m)
 #               define maskSpace       (~0ULL/255 * (32))
 
-                if (hasByteM(eightChars, maskSpace)) break;
-                if (hasZeroByte(eightCharsMasked)) break;
+		if (hasByteM(eightChars, maskSpace)) break;
+		if (hasZeroByte(eightCharsMasked)) break;
 
 #               undef hasZeroByte
 #               undef hasByteM
 #               undef maskSpace
 
-                index += 8;
-            }
-        }
+		index += 8;
+	    }
+	}
 #endif /* POINTER_SIZE == 8*/
 
-        if ((index & 3) == 0) {
-            int len4 = len-4;
-            while (index < len4) {
-                REGISTER unsigned int fourChars;
-                REGISTER unsigned int fourCharsMasked;
-
-                fourChars = ((unsigned int *)(cp+index))[0];
-                fourCharsMasked = fourChars & 0xE0E0E0E0UL;
-
-                // any control char?
-                // (these are 0..31 and also the space);
-                // so we need two compares.
+	if ((index & 3) == 0) {
+	    int len4 = len-4;
+	    while (index < len4) {
+		REGISTER unsigned int fourChars;
+		REGISTER unsigned int fourCharsMasked;
+
+		fourChars = ((unsigned int *)(cp+index))[0];
+		fourCharsMasked = fourChars & 0xE0E0E0E0UL;
+
+		// any control char?
+		// (these are 0..31 and also the space);
+		// so we need two compares.
 #               define hasZeroByte(v) (((v) - 0x01010101UL) & ~(v) & 0x80808080UL)
 #               define hasByteM(v,m)   hasZeroByte( (v) ^ m)
 #               define maskSpace       (~0UL/255 * (32))
 
-                if (hasByteM(fourChars, maskSpace)) break;
-                if (hasZeroByte(fourCharsMasked)) break;
+		if (hasByteM(fourChars, maskSpace)) break;
+		if (hasZeroByte(fourCharsMasked)) break;
 
 #               undef hasZeroByte
 #               undef hasByteM
 #               undef maskSpace
 
-                index += 4;
-            }
-        }
-
-        while (index < len) {
-            REGISTER unsigned char c;
-
-            c = cp[index];
-            if (c <= ' ') {
-                if ((c == ' ') || (c == '\t') || (c == '\n')
-                 || (c == '\r') || (c == '\f')) {
-                    RETURN ( __mkSmallInteger(index+1) );
-                }
-            }
-            index++;
-        }
-        RETURN ( __mkSmallInteger(0) );
+		index += 4;
+	    }
+	}
+
+	while (index < len) {
+	    REGISTER unsigned char c;
+
+	    c = cp[index];
+	    if (c <= ' ') {
+		if ((c == ' ') || (c == '\t') || (c == '\n')
+		 || (c == '\r') || (c == '\f')) {
+		    RETURN ( __mkSmallInteger(index+1) );
+		}
+	    }
+	    index++;
+	}
+	RETURN ( __mkSmallInteger(0) );
     }
 %}.
     ^ super indexOfSeparatorStartingAt:start
@@ -1621,7 +1621,7 @@
      s := String new:1000 withAll:$a.
      self assert:(s indexOfSeparatorStartingAt:1) == 0.
      Time millisecondsToRun:[
-         1000000 timesRepeat:[ s indexOfSeparatorStartingAt:1 ]
+	 1000000 timesRepeat:[ s indexOfSeparatorStartingAt:1 ]
      ]
      original (char-wise):760 760 750
      with 4-byte at a time: 640 650 620
@@ -1633,7 +1633,7 @@
      s at:400 put:(Character return).
      self assert:(s indexOfSeparatorStartingAt:1) == 400.
      Time millisecondsToRun:[
-         1000000 timesRepeat:[ s indexOfSeparatorStartingAt:1 ]
+	 1000000 timesRepeat:[ s indexOfSeparatorStartingAt:1 ]
      ]
      original (char-wise):340 350
      with 4-byte at a time: 310 290 280
@@ -1645,7 +1645,7 @@
      s at:999 put:(Character space).
      self assert:(s indexOfSeparatorStartingAt:1) == 999.
      Time millisecondsToRun:[
-         1000000 timesRepeat:[ s indexOfSeparatorStartingAt:1 ]
+	 1000000 timesRepeat:[ s indexOfSeparatorStartingAt:1 ]
      ]
      original (char-wise): 750 750 790
      with 4-byte at a time: 640 640 620
@@ -2224,8 +2224,8 @@
      This method uses the fnv-1a algorithm
      (which is actually a pretty good one).
      Notice: this returns a 31bit value,
-             even on 64bit CPUs, only small 4-byte hashvalues are returned,
-             (so hash values are independent from the architecture)"
+	     even on 64bit CPUs, only small 4-byte hashvalues are returned,
+	     (so hash values are independent from the architecture)"
 
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
@@ -2238,22 +2238,22 @@
     INT l  = __stringSize(self);
 
     if (!__qIsStringLike(self)) {
-        int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
-
-        cp += n;
-        l -= n;
+	int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
+
+	cp += n;
+	l -= n;
     }
 
     while (l >= 4) {
-        l -= 4;
-        h = (h ^ cp[0]) * 16777619;
-        h = (h ^ cp[1]) * 16777619;
-        h = (h ^ cp[2]) * 16777619;
-        h = (h ^ cp[3]) * 16777619;
-        cp += 4;
+	l -= 4;
+	h = (h ^ cp[0]) * 16777619;
+	h = (h ^ cp[1]) * 16777619;
+	h = (h ^ cp[2]) * 16777619;
+	h = (h ^ cp[3]) * 16777619;
+	cp += 4;
     }
     while (l--) {
-        h = (h ^ *cp++) * 16777619;
+	h = (h ^ *cp++) * 16777619;
     }
     // make it a smallInteger
     h = (h ^ (h >> 30)) & 0x3FFFFFFF;
@@ -2278,34 +2278,36 @@
 
 %{  /* NOCONTEXT */
 #ifndef __SCHTEAM__
+# ifndef __BORLANDC__
     REGISTER unsigned long long h  = 14695981039346656037LL;
     REGISTER unsigned char *cp = __stringVal(self);
     INT l  = __stringSize(self);
 
     if (!__qIsStringLike(self)) {
-        int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
-
-        cp += n;
-        l -= n;
+	int n = __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
+
+	cp += n;
+	l -= n;
     }
 
     while (l >= 4) {
-        l -= 4;
-        h = (h ^ cp[0]) * 1099511628211LL;
-        h = (h ^ cp[1]) * 1099511628211LL;
-        h = (h ^ cp[2]) * 1099511628211LL;
-        h = (h ^ cp[3]) * 1099511628211LL;
-        cp += 4;
+	l -= 4;
+	h = (h ^ cp[0]) * 1099511628211LL;
+	h = (h ^ cp[1]) * 1099511628211LL;
+	h = (h ^ cp[2]) * 1099511628211LL;
+	h = (h ^ cp[3]) * 1099511628211LL;
+	cp += 4;
     }
     while (l--) {
-        h = (h ^ *cp++) * 1099511628211LL;
+	h = (h ^ *cp++) * 1099511628211LL;
     }
     // make it a smallInteger
     h = (h ^ (h >> 30)) & 0x3FFFFFFFFFFFFFFFLL;
     RETURN ( __mkSmallInteger(h));
+# endif /* not BORLAND */
 #endif /* not SCHTEAM */
 %}.
-    ^ self primitiveFailed
+    ^ super hash_fnv1a_64
 
     "
      '' hash_fnv1a_64
@@ -2533,62 +2535,62 @@
     OBJ arg = aString;
 
     if (__qIsStringLike(slf) &&__isStringLike(arg)) {
-        unsigned char *src1, *src2;
-        int len;
-
-        len = __stringSize(slf);
-        if (len != __stringSize(arg)) {
-            RETURN ( false );
-        }
-
-        src1 = __stringVal(slf);
-        src2 = __stringVal(arg);
-
-        // fast skip over same chars
-        while (len >= sizeof(int)) {
-            if ( ((int*)src1)[0] != ((int*)src2)[0] ) break;
-            len -= sizeof(int);
-            src1 += sizeof(int);
-            src2 += sizeof(int);
-        }
-        while (len > 0) {
-            if ( src1[0] != src2[0] ) break;
-            len--;
-            src1++;
-            src2++;
-        }
-        
-        while (len > 0) {
-            // the trouble is, that it is not as easy as we might thing on first thought;
-            // for plain ascii (i.e. 7bits), we can check for chars being letters and then ignore the 0x20 bit.
-            // this even works for the national characters except for 0xFF / 0xDF
-            unsigned char ch1 = src1[0];
-            unsigned char ch2 = src2[0];
-            if (ch1 != ch2) {
-                unsigned char Uch1 = ch1 & ~0x20; // upper cased
-                unsigned char Uch2 = ch2 & ~0x20; // uppÞer cased
-                if ( (Uch1 >= 'A') && (Uch1 <= 'Z') ) {
-                    // letter
-                    if (Uch1 != Uch2) {
-                        RETURN(false);
-                    }    
-                } else {
-                    if ( (Uch1 >= 0xC0) && (Uch1 <= 0xDE) ) {
-                        // national letter 
-                        if (Uch1 != Uch2) {
-                            RETURN(false);
-                        }    
-                    } else {
-                        // other
-                        RETURN(false);
-                    }
-                }
-            }
-            len--;
-            src1++;
-            src2++;
-        }
-        RETURN (true);
+	unsigned char *src1, *src2;
+	int len;
+
+	len = __stringSize(slf);
+	if (len != __stringSize(arg)) {
+	    RETURN ( false );
+	}
+
+	src1 = __stringVal(slf);
+	src2 = __stringVal(arg);
+
+	// fast skip over same chars
+	while (len >= sizeof(int)) {
+	    if ( ((int*)src1)[0] != ((int*)src2)[0] ) break;
+	    len -= sizeof(int);
+	    src1 += sizeof(int);
+	    src2 += sizeof(int);
+	}
+	while (len > 0) {
+	    if ( src1[0] != src2[0] ) break;
+	    len--;
+	    src1++;
+	    src2++;
+	}
+
+	while (len > 0) {
+	    // the trouble is, that it is not as easy as we might thing on first thought;
+	    // for plain ascii (i.e. 7bits), we can check for chars being letters and then ignore the 0x20 bit.
+	    // this even works for the national characters except for 0xFF / 0xDF
+	    unsigned char ch1 = src1[0];
+	    unsigned char ch2 = src2[0];
+	    if (ch1 != ch2) {
+		unsigned char Uch1 = ch1 & ~0x20; // upper cased
+		unsigned char Uch2 = ch2 & ~0x20; // uppÞer cased
+		if ( (Uch1 >= 'A') && (Uch1 <= 'Z') ) {
+		    // letter
+		    if (Uch1 != Uch2) {
+			RETURN(false);
+		    }
+		} else {
+		    if ( (Uch1 >= 0xC0) && (Uch1 <= 0xDE) ) {
+			// national letter
+			if (Uch1 != Uch2) {
+			    RETURN(false);
+			}
+		    } else {
+			// other
+			RETURN(false);
+		    }
+		}
+	    }
+	    len--;
+	    src1++;
+	    src2++;
+	}
+	RETURN (true);
     }
 %}.
     "use fallback for wide strings"
@@ -2602,7 +2604,7 @@
      'hello' sameAs:'hellO'
      'hello' sameAs:'Hellx'
     "
-    
+
     "Created: / 19-07-2018 / 10:44:07 / Claus Gittinger"
 !
 
@@ -2927,66 +2929,66 @@
     REGISTER OBJ slf = self;
 
     if (__isStringLike(slf)) {
-        char quickBuffer[256];
-        int sz = __stringSize(slf);
-
-        if (sz < (sizeof(quickBuffer)-1)) {
-            REGISTER int i = 0;
-            int anyChange = 0;
-            REGISTER unsigned char *cp = __stringVal(slf);
-
-            // fast advance
-            // all uppercase chars are in the ranges 0x41 .. 0x5A (A..Z)
-            // or 0xC0 .. 0xDF.
-            // I.e. they have the 0x20 bit clear.
-            // Thus, we can fast skip over lowercase, spaces and some punctuation,
-            // if all bytes of a word have the x20 bit set.
+	char quickBuffer[256];
+	int sz = __stringSize(slf);
+
+	if (sz < (sizeof(quickBuffer)-1)) {
+	    REGISTER int i = 0;
+	    int anyChange = 0;
+	    REGISTER unsigned char *cp = __stringVal(slf);
+
+	    // fast advance
+	    // all uppercase chars are in the ranges 0x41 .. 0x5A (A..Z)
+	    // or 0xC0 .. 0xDF.
+	    // I.e. they have the 0x20 bit clear.
+	    // Thus, we can fast skip over lowercase, spaces and some punctuation,
+	    // if all bytes of a word have the x20 bit set.
 
 #if __POINTER_SIZE__ == 8
-            for (; i < (sz-8); i += 8) {
-                unsigned INT eightChars = *(unsigned INT *)(cp+i);
-                if ((eightChars & 0x2020202020202020ULL) != 0x2020202020202020ULL) goto convert;
-                *(unsigned INT *)(quickBuffer+i) = eightChars;
-            }
+	    for (; i < (sz-8); i += 8) {
+		unsigned INT eightChars = *(unsigned INT *)(cp+i);
+		if ((eightChars & 0x2020202020202020ULL) != 0x2020202020202020ULL) goto convert;
+		*(unsigned INT *)(quickBuffer+i) = eightChars;
+	    }
 #endif
-            for (; i < (sz-4); i += 4) {
-                unsigned int fourChars = *(unsigned int *)(cp+i);
-                if ((fourChars & 0x20202020U) != 0x20202020U) break;
-                *(unsigned int *)(quickBuffer+i) = fourChars;
-            }
+	    for (; i < (sz-4); i += 4) {
+		unsigned int fourChars = *(unsigned int *)(cp+i);
+		if ((fourChars & 0x20202020U) != 0x20202020U) break;
+		*(unsigned int *)(quickBuffer+i) = fourChars;
+	    }
 convert:
-            for (; i<sz; i++) {
-                unsigned char ch = cp[i];
-
-                quickBuffer[i] = ch;
-                if ((ch & 0x60) == 0x40) {
-                    if (ch >= 'A' && ch <= 'Z') {
-                        quickBuffer[i] = ch - 'A' + 'a';
-                        anyChange = 1;
-                    } else {
-                        // deal with national latin1 characters
-                        if (ch >= 0xC0 && ch <= 0xDE && ch != 0xD7) {
-                            quickBuffer[i] = ch + 0x20;
-                            anyChange = 1;
-                        }
-                    }
-                }
-            }
-            if (! anyChange) {
-                RETURN(slf);
-            }
-            quickBuffer[i] = '\0';
-            RETURN (__MKSTRING_L(quickBuffer, i));
-        }
+	    for (; i<sz; i++) {
+		unsigned char ch = cp[i];
+
+		quickBuffer[i] = ch;
+		if ((ch & 0x60) == 0x40) {
+		    if (ch >= 'A' && ch <= 'Z') {
+			quickBuffer[i] = ch - 'A' + 'a';
+			anyChange = 1;
+		    } else {
+			// deal with national latin1 characters
+			if (ch >= 0xC0 && ch <= 0xDE && ch != 0xD7) {
+			    quickBuffer[i] = ch + 0x20;
+			    anyChange = 1;
+			}
+		    }
+		}
+	    }
+	    if (! anyChange) {
+		RETURN(slf);
+	    }
+	    quickBuffer[i] = '\0';
+	    RETURN (__MKSTRING_L(quickBuffer, i));
+	}
     }
 #endif /* ! __SCHTEAM__ */
 %}.
     ^ super asLowercase
 
     "
-        'Hello WORLD' asLowercase
-        (String new:300) asLowercase
-        #utf8 asLowercase
+	'Hello WORLD' asLowercase
+	(String new:300) asLowercase
+	#utf8 asLowercase
     "
 
     "Modified: / 27-02-2017 / 15:54:13 / stefan"
@@ -4118,14 +4120,14 @@
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
     if (self.isStringLike()) {
-        org.exept.stj.STSystem.err.print(self.asString());
-        return context._RETURN(self);
+	org.exept.stj.STSystem.err.print(self.asString());
+	return context._RETURN(self);
     }
 #else
     if (__qIsStringLike(self)) {
-        console_fprintf(stderr, "%s" , __stringVal(self));
-        console_fflush(stderr);
-        RETURN (self);
+	console_fprintf(stderr, "%s" , __stringVal(self));
+	console_fflush(stderr);
+	RETURN (self);
     }
 #endif /* not SCHTEAM */
 %}.
@@ -4141,14 +4143,14 @@
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
     if (self.isStringLike()) {
-        org.exept.stj.STSystem.err.println(self.asString());
-        return context._RETURN(self);
+	org.exept.stj.STSystem.err.println(self.asString());
+	return context._RETURN(self);
     }
 #else
     if (__qIsStringLike(self)) {
-        console_fprintf(stderr, "%s\n" , __stringVal(self));
-        console_fflush(stderr);
-        RETURN (self);
+	console_fprintf(stderr, "%s\n" , __stringVal(self));
+	console_fflush(stderr);
+	RETURN (self);
     }
 #endif
 %}.
@@ -4167,9 +4169,9 @@
     return context._RETURN(self);
 #else
     if (__qIsStringLike(self)) {
-        console_fprintf(stdout, "%s" , __stringVal(self));
-        console_fflush(stdout);
-        RETURN (self);
+	console_fprintf(stdout, "%s" , __stringVal(self));
+	console_fflush(stdout);
+	RETURN (self);
     }
 #endif
 %}.
@@ -4188,9 +4190,9 @@
     return context._RETURN(self);
 #else
     if (__qIsStringLike(self)) {
-        console_fprintf(stdout, "%s\n" , __stringVal(self));
-        console_fflush(stdout);
-        RETURN (self);
+	console_fprintf(stdout, "%s\n" , __stringVal(self));
+	console_fflush(stdout);
+	RETURN (self);
     }
 #endif
 %}.
@@ -4211,13 +4213,13 @@
     "print the receiver on standard error, if the global Stderr is nil;
      otherwise, fall back to the inherited errorPrint, which sends the string to
      the Stderr stream or to a logger.
-     Redefined to be able to print during early startup, 
+     Redefined to be able to print during early startup,
      when the stream classes have not yet been initialized (i.e. Stderr is nil)."
 
     Stderr isNil ifTrue:[
-        self _errorPrint
+	self _errorPrint
     ] ifFalse:[
-        super errorPrint
+	super errorPrint
     ].
 
     "
@@ -4232,13 +4234,13 @@
     "print the receiver on standard error, followed by a cr,
      if the global Stderr is nil; otherwise, fall back to the inherited errorPrintCR,
      which sends the string to the Stderr stream or to a logger.
-     Redefined to be able to print during early startup, 
+     Redefined to be able to print during early startup,
      when the stream classes have not yet been initialized (i.e. Stderr is nil)."
 
     Stderr isNil ifTrue:[
-        self _errorPrintCR
+	self _errorPrintCR
     ] ifFalse:[
-        super errorPrintCR
+	super errorPrintCR
     ].
 !
 
@@ -4252,14 +4254,14 @@
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
     if (self.isStringLike()) {
-        org.exept.stj.STSystem.err.print(self.asString());
-        return context._RETURN(self);
+	org.exept.stj.STSystem.err.print(self.asString());
+	return context._RETURN(self);
     }
 #else
     if (__qIsStringLike(self)) {
-        console_fprintf(stderr, "%s" , __stringVal(self));
-        console_fflush(stderr);
-        RETURN (self);
+	console_fprintf(stderr, "%s" , __stringVal(self));
+	console_fflush(stderr);
+	RETURN (self);
     }
 #endif /* not SCHTEAM */
 %}.
@@ -4282,14 +4284,14 @@
 %{  /* NOCONTEXT */
 #ifdef __SCHTEAM__
     if (self.isStringLike()) {
-        org.exept.stj.STSystem.err.println(self.asString());
-        return context._RETURN(self);
+	org.exept.stj.STSystem.err.println(self.asString());
+	return context._RETURN(self);
     }
 #else
     if (__qIsStringLike(self)) {
-        console_fprintf(stderr, "%s\n" , __stringVal(self));
-        console_fflush(stderr);
-        RETURN (self);
+	console_fprintf(stderr, "%s\n" , __stringVal(self));
+	console_fflush(stderr);
+	RETURN (self);
     }
 #endif
 %}.
@@ -4308,9 +4310,9 @@
     return context._RETURN(self);
 #else
     if (__qIsStringLike(self)) {
-        console_fprintf(stdout, "%s" , __stringVal(self));
-        console_fflush(stdout);
-        RETURN (self);
+	console_fprintf(stdout, "%s" , __stringVal(self));
+	console_fflush(stdout);
+	RETURN (self);
     }
 #endif
 %}.
@@ -4329,9 +4331,9 @@
     return context._RETURN(self);
 #else
     if (__qIsStringLike(self)) {
-        console_fprintf(stdout, "%s\n" , __stringVal(self));
-        console_fflush(stdout);
-        RETURN (self);
+	console_fprintf(stdout, "%s\n" , __stringVal(self));
+	console_fflush(stdout);
+	RETURN (self);
     }
 #endif
 %}.
@@ -4341,13 +4343,13 @@
     "print the receiver on standard output, if the global Stdout is nil;
      otherwise, fall back to the inherited print,
      which sends the string to the Stdout stream.
-     Redefined to be able to print during early startup, 
+     Redefined to be able to print during early startup,
      when the stream classes have not yet been initialized (i.e. Stdout is nil)."
 
     Stdout isNil ifTrue:[
-        self _print
+	self _print
     ] ifFalse:[
-        super print
+	super print
     ].
 !
 
@@ -4355,13 +4357,13 @@
     "print the receiver on standard output, followed by a cr,
      if the global Stdout is nil; otherwise, fall back to the inherited errorPrintCR,
      which sends the string to the Stdout stream.
-     Redefined to be able to print during early startup, 
+     Redefined to be able to print during early startup,
      when the stream classes have not yet been initialized (i.e. Stdout is nil)."
 
     Stdout isNil ifTrue:[
-        self _printCR
+	self _printCR
     ] ifFalse:[
-        super printCR
+	super printCR
     ].
 !
 
@@ -4374,7 +4376,7 @@
 
      This method is NONSTANDARD and may be removed without notice.
      WARNNG: this goes directly to the C-printf function and may therefore be inherently unsafe.
-     Please use the printf: method, which is both safe 
+     Please use the printf: method, which is both safe
      and completely implemented in Smalltalk."
 
 %{  /* STACK: 1000 */
@@ -4389,44 +4391,44 @@
     extern void *malloc();
 
     if (__isStringLike(formatString)) {
-        cp = (char *)__stringVal(self);
-        if (__qClass(self) != String) {
-            cp += __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
-        }
+	cp = (char *)__stringVal(self);
+	if (__qClass(self) != String) {
+	    cp += __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
+	}
 again:
-        /*
-         * actually only needed on sparc: since thisContext is
-         * in a global register, which gets destroyed by printf,
-         * manually save it here - very stupid ...
-         */
-        __BEGIN_PROTECT_REGISTERS__
-
-        len = snprintf(buf, bufsize, (char *)__stringVal(formatString), cp);
-
-        __END_PROTECT_REGISTERS__
-
-        if ((len < 0) || (len > bufsize)) {
-            if (len < 0) {
-                bufsize = bufsize * 2;
-            } else {
-                bufsize = len + 1;
-            }
-            if (mallocbuf)
-                free(mallocbuf);
-            buf = mallocbuf = malloc(bufsize);
-            if (buf == NULL)
-                goto fail;
-            goto again;
-        }
-
-        s = __MKSTRING_L(buf, len);
-
-        if (mallocbuf)
-            free(mallocbuf);
-
-        if (s != nil) {
-            RETURN (s);
-        }
+	/*
+	 * actually only needed on sparc: since thisContext is
+	 * in a global register, which gets destroyed by printf,
+	 * manually save it here - very stupid ...
+	 */
+	__BEGIN_PROTECT_REGISTERS__
+
+	len = snprintf(buf, bufsize, (char *)__stringVal(formatString), cp);
+
+	__END_PROTECT_REGISTERS__
+
+	if ((len < 0) || (len > bufsize)) {
+	    if (len < 0) {
+		bufsize = bufsize * 2;
+	    } else {
+		bufsize = len + 1;
+	    }
+	    if (mallocbuf)
+		free(mallocbuf);
+	    buf = mallocbuf = malloc(bufsize);
+	    if (buf == NULL)
+		goto fail;
+	    goto again;
+	}
+
+	s = __MKSTRING_L(buf, len);
+
+	if (mallocbuf)
+	    free(mallocbuf);
+
+	if (s != nil) {
+	    RETURN (s);
+	}
     }
 fail:;
 #endif
@@ -4450,9 +4452,9 @@
 
     aStream nextPut:$'.
     (self includes:$') ifTrue:[
-        self printWithQuotesDoubledOn:aStream
+	self printWithQuotesDoubledOn:aStream
     ] ifFalse:[
-        aStream nextPutAll:self
+	aStream nextPutAll:self
     ].
     aStream nextPut:$'
 
@@ -4620,25 +4622,25 @@
 
     src = __stringVal(self);
     if ((cls = __qClass(self)) != String)
-        src += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-
-    // hop along in bigger steps if possible    
+	src += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+
+    // hop along in bigger steps if possible
 # ifdef UINT64
     while (*((UINT64 *)src) == 0x2020202020202020L) {
-        src += 8;
+	src += 8;
     }
 # endif /* UINT64 */
     while (*((unsigned *)src) == 0x20202020) {
-        src += 4;
+	src += 4;
     }
     while (*((unsigned short *)src) == 0x2020) {
-        src += 2;
+	src += 2;
     }
 
     while ((c = *src++) == ' ')
-        ;; /* just walking along */
+	;; /* just walking along */
     if (c != '\0') {
-        RETURN ( false );
+	RETURN ( false );
     }
     RETURN ( true );
 # endif /* ! __SCHTEAM__ */
@@ -4655,7 +4657,7 @@
 %{  /* NOCONTEXT */
 #ifndef __SCHTEAM__
     if (__isStringLike(self)) {
-        RETURN ( (__stringSize(self) == 0) ? true : false);
+	RETURN ( (__stringSize(self) == 0) ? true : false);
     }
 #endif /* ! __SCHTEAM__ */
 %}.
@@ -4707,7 +4709,7 @@
 %{  /* NOCONTEXT */
 #ifndef __SCHTEAM__
     if (__isStringLike(self)) {
-        RETURN ( (__stringSize(self) != 0) ? true : false);
+	RETURN ( (__stringSize(self) != 0) ? true : false);
     }
 #endif /* ! __SCHTEAM__ */
 %}.
@@ -4765,11 +4767,11 @@
     unsigned INT len = 0;
 
     if (!__isStringLike(self)) {
-        cp += __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
+	cp += __OBJS2BYTES__(__intVal(__ClassInstPtr(__qClass(self))->c_ninstvars));
     }
     // count the number of start-bytes
     for ( ; cp < last; cp++) {
-        if ((*cp & 0xC0) != 0x80) len++;
+	if ((*cp & 0xC0) != 0x80) len++;
     }
     RETURN (__mkSmallInteger(len));
 %}.
@@ -4788,7 +4790,7 @@
 reverseFrom:startIndex to:endIndex
     "in-place reverse the characters of the string.
      WARNING: this is a destructive operation, which modifies the receiver.
-              Please use reversed (with a d) for a functional version."
+	      Please use reversed (with a d) for a functional version."
 
     "Q: is there a need to redefine it here ?"
 
@@ -4800,23 +4802,23 @@
     if (__isString(self)
      && __isSmallInteger(startIndex)
      && __isSmallInteger(endIndex)) {
-        int _start = __intVal(startIndex) - 1;
-        int _end = __intVal(endIndex) - 1;
-
-        if ((_start >= 0) 
-         && (_end < __stringSize(self))
-         && (_end >= _start)) {
-            lowp = __stringVal(self) + _start;
-            hip = __stringVal(self) + _end;
-            while (lowp < hip) {
-                c = *lowp;
-                *lowp = *hip;
-                *hip = c;
-                lowp++;
-                hip--;
-            }
-            RETURN ( self );
-        }
+	int _start = __intVal(startIndex) - 1;
+	int _end = __intVal(endIndex) - 1;
+
+	if ((_start >= 0)
+	 && (_end < __stringSize(self))
+	 && (_end >= _start)) {
+	    lowp = __stringVal(self) + _start;
+	    hip = __stringVal(self) + _end;
+	    while (lowp < hip) {
+		c = *lowp;
+		*lowp = *hip;
+		*hip = c;
+		lowp++;
+		hip--;
+	    }
+	    RETURN ( self );
+	}
     }
 #endif
 %}.
@@ -4849,10 +4851,10 @@
 
 !String methodsFor:'substring searching'!
 
-caseInsensitiveIndexOfSubCollection:aSubString startingAt:startIndex ifAbsent:exceptionValue 
+caseInsensitiveIndexOfSubCollection:aSubString startingAt:startIndex ifAbsent:exceptionValue
     "naive search fallback (non-BM).
      Private method to speed up caseInSensitive searches"
-    
+
     |notFound|
 
 %{
@@ -4862,92 +4864,92 @@
      && (__isSmallInteger(startIndex))
      && (__intVal(startIndex) > 0)
     ) {
-        unsigned char *c_pSelf = __stringVal(self);
-        unsigned char *c_substring = __stringVal(aSubString);
-        unsigned char *c_pSelfI, *c_pSelfMax;
-        int c_lenSelf = __stringSize(self);
-        int c_lenSubstring = __stringSize(aSubString);
-        int c_idx0Max = c_lenSelf - c_lenSubstring;
-        unsigned char c_first;
-        unsigned char c_oppositeCaseFirst = 0;
-        int i;
-
-        if (c_lenSubstring == 0) {
+	unsigned char *c_pSelf = __stringVal(self);
+	unsigned char *c_substring = __stringVal(aSubString);
+	unsigned char *c_pSelfI, *c_pSelfMax;
+	int c_lenSelf = __stringSize(self);
+	int c_lenSubstring = __stringSize(aSubString);
+	int c_idx0Max = c_lenSelf - c_lenSubstring;
+	unsigned char c_first;
+	unsigned char c_oppositeCaseFirst = 0;
+	int i;
+
+	if (c_lenSubstring == 0) {
 #if 1
-            /* empty string does not match */
-            notFound = true;
-            goto getOutOfHere;
+	    /* empty string does not match */
+	    notFound = true;
+	    goto getOutOfHere;
 #else
-            /* empty string matches */
-            RETURN(startIndex);
+	    /* empty string matches */
+	    RETURN(startIndex);
 #endif
-        }
-
-        // searched string's length > string
-        if (c_idx0Max < 0) {
-            notFound = true;
-            goto getOutOfHere;
-        }
-
-        c_first = c_substring[0];
-        if (((c_first >= 'A') && (c_first <= 'Z'))
-         || ((c_first >= 0xC0) && (c_first <= 0xDE) && (c_first != 0xD7))) {
-            c_oppositeCaseFirst = c_first - 'A' + 'a';
-        } else {
-            if (((c_first >= 'a') && (c_first <= 'z'))
-              || ((c_first >= 0xE0) && (c_first <= 0xFE) && (c_first != 0xF7))) {
-                c_oppositeCaseFirst = c_first - 'a' + 'A';
-            }
-        }
-
-        // idx:
-        // 0123456789
-
-        // 1234567890 - lenSelf = 10
-        // abc        - lenSubstring = 3
-        //            - idx0Max = 7 (last legal startIndex)
-
-        i = __intVal(startIndex) - 1;
-        c_pSelfI = c_pSelf + i;
-        c_pSelfMax = c_pSelf + c_idx0Max;
-
-        for (; c_pSelfI <= c_pSelfMax; c_pSelfI++) {
-            int j;
-            unsigned char c_selfChar;
-
-            // find the first char
-            c_selfChar = c_pSelfI[0];
-            if (c_selfChar != c_first && c_selfChar != c_oppositeCaseFirst) {
+	}
+
+	// searched string's length > string
+	if (c_idx0Max < 0) {
+	    notFound = true;
+	    goto getOutOfHere;
+	}
+
+	c_first = c_substring[0];
+	if (((c_first >= 'A') && (c_first <= 'Z'))
+	 || ((c_first >= 0xC0) && (c_first <= 0xDE) && (c_first != 0xD7))) {
+	    c_oppositeCaseFirst = c_first - 'A' + 'a';
+	} else {
+	    if (((c_first >= 'a') && (c_first <= 'z'))
+	      || ((c_first >= 0xE0) && (c_first <= 0xFE) && (c_first != 0xF7))) {
+		c_oppositeCaseFirst = c_first - 'a' + 'A';
+	    }
+	}
+
+	// idx:
+	// 0123456789
+
+	// 1234567890 - lenSelf = 10
+	// abc        - lenSubstring = 3
+	//            - idx0Max = 7 (last legal startIndex)
+
+	i = __intVal(startIndex) - 1;
+	c_pSelfI = c_pSelf + i;
+	c_pSelfMax = c_pSelf + c_idx0Max;
+
+	for (; c_pSelfI <= c_pSelfMax; c_pSelfI++) {
+	    int j;
+	    unsigned char c_selfChar;
+
+	    // find the first char
+	    c_selfChar = c_pSelfI[0];
+	    if (c_selfChar != c_first && c_selfChar != c_oppositeCaseFirst) {
 searchNext: ;
-                continue;
-            }
-
-            // first char matches
-            // compare rest
-            for (j=1; j<c_lenSubstring; j++) {
-                unsigned char c_subChar = c_substring[j];
-                unsigned char c_selfChar = c_pSelfI[j];
-
-                if (c_selfChar == c_subChar) continue;
-
-                if (((c_subChar >= 'A') && (c_subChar <= 'Z'))
-                 || ((c_subChar >= 0xC0) && (c_subChar <= 0xDE) && (c_subChar != 0xD7))) {
-                    unsigned char c_lcSubChar = c_subChar - 'A' + 'a';
-                    if (c_selfChar != c_lcSubChar) goto searchNext;
-                } else {
-                    if (((c_subChar >= 'a') && (c_subChar <= 'z'))
-                     || ((c_subChar >= 0xE0) && (c_subChar <= 0xFE) && (c_subChar != 0xF7))) {
-                        unsigned char c_ucSubChar = c_subChar - 'a' + 'A';
-                        if (c_selfChar != c_ucSubChar) goto searchNext;
-                    } else {
-                        goto searchNext;
-                    }
-                }
-            }
-            // if we arrive here, we have a match at i
-            RETURN( __mkSmallInteger( c_pSelfI - c_pSelf + 1 ) );
-        }
-        notFound = true;
+		continue;
+	    }
+
+	    // first char matches
+	    // compare rest
+	    for (j=1; j<c_lenSubstring; j++) {
+		unsigned char c_subChar = c_substring[j];
+		unsigned char c_selfChar = c_pSelfI[j];
+
+		if (c_selfChar == c_subChar) continue;
+
+		if (((c_subChar >= 'A') && (c_subChar <= 'Z'))
+		 || ((c_subChar >= 0xC0) && (c_subChar <= 0xDE) && (c_subChar != 0xD7))) {
+		    unsigned char c_lcSubChar = c_subChar - 'A' + 'a';
+		    if (c_selfChar != c_lcSubChar) goto searchNext;
+		} else {
+		    if (((c_subChar >= 'a') && (c_subChar <= 'z'))
+		     || ((c_subChar >= 0xE0) && (c_subChar <= 0xFE) && (c_subChar != 0xF7))) {
+			unsigned char c_ucSubChar = c_subChar - 'a' + 'A';
+			if (c_selfChar != c_ucSubChar) goto searchNext;
+		    } else {
+			goto searchNext;
+		    }
+		}
+	    }
+	    // if we arrive here, we have a match at i
+	    RETURN( __mkSmallInteger( c_pSelfI - c_pSelf + 1 ) );
+	}
+	notFound = true;
     }
 
     getOutOfHere: ;
@@ -4955,36 +4957,36 @@
 %}.
 
     notFound == true ifTrue:[
-        ^ exceptionValue value.
+	^ exceptionValue value.
     ].
 
     "/ arrive here aSubstring is a UnicodeString or arguments are invalid
-    ^ super 
-        indexOfSubCollection:aSubString
-        startingAt:startIndex
-        ifAbsent:exceptionValue
-        caseSensitive:false
+    ^ super
+	indexOfSubCollection:aSubString
+	startingAt:startIndex
+	ifAbsent:exceptionValue
+	caseSensitive:false
 
     "
      'abcdefg' caseInsensitiveIndexOfSubCollection:'abc' startingAt:1 ifAbsent:nil
-     'abcdefg' caseInsensitiveIndexOfSubCollection:'bcd' startingAt:1 ifAbsent:nil 
-     'abcdefg' caseInsensitiveIndexOfSubCollection:'cde' startingAt:1 ifAbsent:nil 
-     'abcabcg' caseInsensitiveIndexOfSubCollection:'abc' startingAt:2 ifAbsent:nil 
-
-     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'abc' startingAt:1 ifAbsent:nil 
-     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'Abc' startingAt:1 ifAbsent:nil 
-     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'aBC' startingAt:1 ifAbsent:nil 
-     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'ABC' startingAt:1 ifAbsent:nil 
-
-     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'a' startingAt:1 ifAbsent:nil 
-     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'A' startingAt:1 ifAbsent:nil 
-
-     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'bcd' startingAt:1 ifAbsent:nil 
-     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'cde' startingAt:1 ifAbsent:nil 
-     'ABCABCG' caseInsensitiveIndexOfSubCollection:'abc' startingAt:2 ifAbsent:nil 
-
-     '1234567890' caseInsensitiveIndexOfSubCollection:'abc' startingAt:1 ifAbsent:nil 
-     '1234567890' caseInsensitiveIndexOfSubCollection:'123' startingAt:1 ifAbsent:nil 
+     'abcdefg' caseInsensitiveIndexOfSubCollection:'bcd' startingAt:1 ifAbsent:nil
+     'abcdefg' caseInsensitiveIndexOfSubCollection:'cde' startingAt:1 ifAbsent:nil
+     'abcabcg' caseInsensitiveIndexOfSubCollection:'abc' startingAt:2 ifAbsent:nil
+
+     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'abc' startingAt:1 ifAbsent:nil
+     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'Abc' startingAt:1 ifAbsent:nil
+     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'aBC' startingAt:1 ifAbsent:nil
+     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'ABC' startingAt:1 ifAbsent:nil
+
+     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'a' startingAt:1 ifAbsent:nil
+     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'A' startingAt:1 ifAbsent:nil
+
+     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'bcd' startingAt:1 ifAbsent:nil
+     'ABCDEFG' caseInsensitiveIndexOfSubCollection:'cde' startingAt:1 ifAbsent:nil
+     'ABCABCG' caseInsensitiveIndexOfSubCollection:'abc' startingAt:2 ifAbsent:nil
+
+     '1234567890' caseInsensitiveIndexOfSubCollection:'abc' startingAt:1 ifAbsent:nil
+     '1234567890' caseInsensitiveIndexOfSubCollection:'123' startingAt:1 ifAbsent:nil
     "
 
     "Created: / 28-03-2017 / 15:33:50 / stefan"
@@ -4997,7 +4999,7 @@
     |notFound|
 
     caseSensitive ifFalse:[
-        ^ self caseInsensitiveIndexOfSubCollection:aSubString startingAt:startIndex ifAbsent:exceptionValue.
+	^ self caseInsensitiveIndexOfSubCollection:aSubString startingAt:startIndex ifAbsent:exceptionValue.
     ].
 
 %{  /* STACK:4000 */
@@ -5007,112 +5009,112 @@
      && (__isSmallInteger(startIndex))
      && (__intVal(startIndex) > 0)
     ) {
-        unsigned char *y = __stringVal(self);
-        unsigned char *x = __stringVal(aSubString);
-        int m = __stringSize(aSubString);
-        int n = __stringSize(self);
+	unsigned char *y = __stringVal(self);
+	unsigned char *x = __stringVal(aSubString);
+	int m = __stringSize(aSubString);
+	int n = __stringSize(self);
 #       define MAX_PATTERN_SIZE 128
 #       define XSIZE 256
 #       define ASIZE 256
 #       define MAX(a,b) (a>b ? a : b)
 
-        if (m == 0) {
+	if (m == 0) {
 #if 1
-            /* empty string does not match */
-            RETURN(__mkSmallInteger(0));
+	    /* empty string does not match */
+	    RETURN(__mkSmallInteger(0));
 #else
-            /* empty string matches */
-            RETURN(startIndex);
+	    /* empty string matches */
+	    RETURN(startIndex);
 #endif
-        }
-        if (m <= XSIZE) {
-            int i, j;
-            static int lastPatternSize = 0;
-            static char lastPattern[MAX_PATTERN_SIZE+1] = { 0 };
-            static int bmGs[XSIZE+1], bmBc[ASIZE];
+	}
+	if (m <= XSIZE) {
+	    int i, j;
+	    static int lastPatternSize = 0;
+	    static char lastPattern[MAX_PATTERN_SIZE+1] = { 0 };
+	    static int bmGs[XSIZE+1], bmBc[ASIZE];
 
 #           define preBmBc(x, m, bmBc) {          \
-               int i;                             \
-                                                  \
-               for (i = 0; i < ASIZE; ++i)        \
-                  bmBc[i] = m;                    \
-               for (i = 0; i < m - 1; ++i)        \
-                  bmBc[x[i]] = m - i - 1;         \
-            }
+	       int i;                             \
+						  \
+	       for (i = 0; i < ASIZE; ++i)        \
+		  bmBc[i] = m;                    \
+	       for (i = 0; i < m - 1; ++i)        \
+		  bmBc[x[i]] = m - i - 1;         \
+	    }
 
 #           define suffixes(x, m, suff) {                       \
-               int f, g, i;                                     \
-                                                                \
-               suff[m - 1] = m;                                 \
-               g = m - 1;                                       \
-               for (i = m - 2; i >= 0; --i) {                   \
-                  if (i > g && suff[i + m - 1 - f] < i - g)     \
-                     suff[i] = suff[i + m - 1 - f];             \
-                  else {                                        \
-                     if (i < g)                                 \
-                        g = i;                                  \
-                     f = i;                                     \
-                     while (g >= 0 && x[g] == x[g + m - 1 - f]) \
-                        --g;                                    \
-                     suff[i] = f - g;                           \
-                  }                                             \
-               }                                                \
-            }
+	       int f, g, i;                                     \
+								\
+	       suff[m - 1] = m;                                 \
+	       g = m - 1;                                       \
+	       for (i = m - 2; i >= 0; --i) {                   \
+		  if (i > g && suff[i + m - 1 - f] < i - g)     \
+		     suff[i] = suff[i + m - 1 - f];             \
+		  else {                                        \
+		     if (i < g)                                 \
+			g = i;                                  \
+		     f = i;                                     \
+		     while (g >= 0 && x[g] == x[g + m - 1 - f]) \
+			--g;                                    \
+		     suff[i] = f - g;                           \
+		  }                                             \
+	       }                                                \
+	    }
 
 #           define preBmGs(x, m, bmGs) {                        \
-               int i, j, suff[XSIZE];                           \
-                                                                \
-               suffixes(x, m, suff);                            \
-                                                                \
-               for (i = 0; i < m; ++i)                          \
-                  bmGs[i] = m;                                  \
-               j = 0;                                           \
-               for (i = m - 1; i >= 0; --i)                     \
-                  if (suff[i] == i + 1)                         \
-                     for (; j < m - 1 - i; ++j)                 \
-                        if (bmGs[j] == m)                       \
-                           bmGs[j] = m - 1 - i;                 \
-               for (i = 0; i <= m - 2; ++i)                     \
-                  bmGs[m - 1 - suff[i]] = m - 1 - i;            \
-            }
-
-            /* tables only depend on pattern; so we can cache them in case the same string is searched again */
-            if ((m == lastPatternSize)
-             && (strcmp(lastPattern, x) == 0)) {
-                /* tables are still valid */
-                // printf("valid: \"%s\"\n", lastPattern);
-            } else {
-                /* Preprocessing */
-                // printf("compute: \"%s\"\n", lastPattern);
-                preBmGs(x, m, bmGs);
-                preBmBc(x, m, bmBc);
-                if (m <= MAX_PATTERN_SIZE) {
-                    // printf("cache for: \"%s\"\n", lastPattern);
-                    strcpy(lastPattern, x);
-                    lastPatternSize = m;
-                }
-            }
-
-            /* Searching */
-            j = __intVal(startIndex) - 1;
-            while (j <= n - m) {
-               for (i = m - 1; i >= 0 && x[i] == y[i + j]; --i);
-               if (i < 0) {
-                  RETURN (__mkSmallInteger(j+1));
-                  j += bmGs[0];
-               } else {
-                  int s1 = bmGs[i];
-                  int s2 = bmBc[y[i + j]] - m + 1 + i;
-                  j += MAX(s1, s2);
-               }
-            }
-            notFound = true;
-        }
+	       int i, j, suff[XSIZE];                           \
+								\
+	       suffixes(x, m, suff);                            \
+								\
+	       for (i = 0; i < m; ++i)                          \
+		  bmGs[i] = m;                                  \
+	       j = 0;                                           \
+	       for (i = m - 1; i >= 0; --i)                     \
+		  if (suff[i] == i + 1)                         \
+		     for (; j < m - 1 - i; ++j)                 \
+			if (bmGs[j] == m)                       \
+			   bmGs[j] = m - 1 - i;                 \
+	       for (i = 0; i <= m - 2; ++i)                     \
+		  bmGs[m - 1 - suff[i]] = m - 1 - i;            \
+	    }
+
+	    /* tables only depend on pattern; so we can cache them in case the same string is searched again */
+	    if ((m == lastPatternSize)
+	     && (strcmp(lastPattern, x) == 0)) {
+		/* tables are still valid */
+		// printf("valid: \"%s\"\n", lastPattern);
+	    } else {
+		/* Preprocessing */
+		// printf("compute: \"%s\"\n", lastPattern);
+		preBmGs(x, m, bmGs);
+		preBmBc(x, m, bmBc);
+		if (m <= MAX_PATTERN_SIZE) {
+		    // printf("cache for: \"%s\"\n", lastPattern);
+		    strcpy(lastPattern, x);
+		    lastPatternSize = m;
+		}
+	    }
+
+	    /* Searching */
+	    j = __intVal(startIndex) - 1;
+	    while (j <= n - m) {
+	       for (i = m - 1; i >= 0 && x[i] == y[i + j]; --i);
+	       if (i < 0) {
+		  RETURN (__mkSmallInteger(j+1));
+		  j += bmGs[0];
+	       } else {
+		  int s1 = bmGs[i];
+		  int s2 = bmBc[y[i + j]] - m + 1 + i;
+		  j += MAX(s1, s2);
+	       }
+	    }
+	    notFound = true;
+	}
     }
 #endif /* ! __SCHTEAM__ */
 %}.
     notFound == true ifTrue:[
-        ^ exceptionValue value.
+	^ exceptionValue value.
     ].
 
     "/ arrive here aSubstring is a UnicodeString or arguments are invalid
@@ -5158,4 +5160,3 @@
 version_CVS
     ^ '$Header$'
 ! !
-