private void ssInsertionSort (int PA, int first, int last, int depth) {

		final int[] SA = this.SA;

		int i, j; // pointer within SA
		int t;
		int r;

		for (i = last - 2; first <= i; --i) {
			for (t = SA[i], j = i + 1; 0 < (r = ssCompare (PA + t, PA + SA[j], depth));) {
				do {
					SA[j - 1] = SA[j];
				} while ((++j < last) && (SA[j] < 0));
				if (last <= j) {
					break;
				}
			}
			if (r == 0) {
				SA[j] = ~SA[j];
			}
			SA[j - 1] = t;
		}

	}