Taylor Blau <me@xxxxxxxxxxxx> writes: > -int find_revindex_position(struct packed_git *p, off_t ofs) > +int offset_to_pack_pos(struct packed_git *p, off_t ofs, uint32_t *pos) > { > - int lo = 0; > - int hi = p->num_objects + 1; > - const struct revindex_entry *revindex = p->revindex; > + unsigned lo, hi; > + const struct revindex_entry *revindex; > + > + if (load_pack_revindex(p) < 0) > + return -1; > + > + lo = 0; > + hi = p->num_objects + 1; > + revindex = p->revindex; > do { > const unsigned mi = lo + (hi - lo) / 2; > if (revindex[mi].offset == ofs) { > - return mi; > + *pos = mi; > + return 0; > } else if (ofs < revindex[mi].offset) > hi = mi; > else OK, we can safely depend on "unsigned int" at least as wide as "uint32_t"; unlike the original that used "int", we won't risk losing the upper half of 4G range. Nice.