int firstSeg = start>>BITS;
int lastSeg = (end-1)>>BITS;
if (firstSeg == lastSeg) {
return new CharSlice(data[firstSeg], start & MASK, end - start);
} else {
FastStringBuffer fsb = new FastStringBuffer(end - start);
int firstSegLen = SEGLEN - (start & MASK);
fsb.append(data[firstSeg], start & MASK, firstSegLen);
int doneTo = start + firstSegLen;
while (true) {
firstSeg++;
if (doneTo + SEGLEN < end) {
fsb.append(data[firstSeg]);
doneTo += SEGLEN;
} else {
fsb.append(data[firstSeg], 0, end - doneTo);
break;
}
}
return fsb;
}