midx: use hashwrite_be64()

Call hashwrite_be64() to write 64-bit values instead of open-coding it using hashwrite_be32() and sizeof. This shortens the code and makes its intent clearer. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Nov 12, 2020 at 13:22 UTC ef1b853c15d443b057e5a6306c89b869168a8270
1 file changed +2 -5
midx.c
+2 -5
@@ -790,9 +790,7 @@ static size_t write_midx_large_offsets(struct hashfile *f, uint32_t nr_large_off
790 if (!(offset >> 31))
791 continue;
792
793 - hashwrite_be32(f, offset >> 32);
794 - hashwrite_be32(f, offset & 0xffffffffUL);
795 - written += 2 * sizeof(uint32_t);
793 + written += hashwrite_be64(f, offset);
794
795 nr_large_offset--;
796 }
@@ -980,8 +978,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
978 chunk_offsets[i]);
979
980 hashwrite_be32(f, chunk_ids[i]);
983 - hashwrite_be32(f, chunk_offsets[i] >> 32);
984 - hashwrite_be32(f, chunk_offsets[i]);
981 + hashwrite_be64(f, chunk_offsets[i]);
982
983 written += MIDX_CHUNKLOOKUP_WIDTH;
984 }