private int ssSubstringPartition (final int PA, final int first, final int last, final int depth) {

		final int[] SA = this.SA;

		int a, b;
		int t;

		for (a = first - 1, b = last;;) {
			for (; (++a < b) && ((SA[PA + SA[a]] + depth) >= (SA[PA + SA[a] + 1] + 1));) {
				SA[a] = ~SA[a];
			}
			for (; (a < --b) && ((SA[PA + SA[b]] + depth) <  (SA[PA + SA[b] + 1] + 1)););
			if (b <= a) {
				break;
			}
			t = ~SA[b];
			SA[b] = SA[a];
			SA[a] = t;
		}
		if (first < a) {
			SA[first] = ~SA[first];
		}

		return a;

	}