commit 2b2ca9f01de591f1cf0cca17acf742542233b152 from: Stefan Sperling date: Sat Jan 13 11:33:21 2018 UTC call got_object_id_cmp() just once in got_object_idx() commit - 0465ef11f19a12de1c675fbdc59e445c8ea10fb1 commit + 2b2ca9f01de591f1cf0cca17acf742542233b152 blob - e5e1540f37fc42c5955034c40350d0b96165cec9 blob + 1d72c45b4b45fd02412f79ffadcea87f2b55a0e3 --- lib/pack.c +++ lib/pack.c @@ -294,10 +294,11 @@ get_object_idx(struct got_packidx_v2_hdr *packidx, str while (i < totobj) { struct got_object_id *oid = &packidx->sorted_ids[i++]; uint32_t offset; + int cmp = got_object_id_cmp(id, oid); - if (got_object_id_cmp(id, oid) < 0) + if (cmp < 0) continue; - if (got_object_id_cmp(id, oid) > 0) + if (cmp > 0) break; return i;