private static int offsetFieldToInlineFileOffset(long offset, int recordIndex) throws HgInvalidStateException {
int o = Internals.ltoi(offset);
if (o != offset) {
// just in case, can't happen, ever, unless HG (or some other bad tool) produces index file
// with inlined data of size greater than 2 Gb.
throw new HgInvalidStateException("Data too big, offset didn't fit to sizeof(int)");
}
return o + REVLOGV1_RECORD_SIZE * recordIndex;
}