Skip to content

Commit ef1b853

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 54273d1 commit ef1b853

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

midx.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -790,9 +790,7 @@ static size_t write_midx_large_offsets(struct hashfile *f, uint32_t nr_large_off
790790
if (!(offset >> 31))
791791
continue;
792792

793-
hashwrite_be32(f, offset >> 32);
794-
hashwrite_be32(f, offset & 0xffffffffUL);
795-
written += 2 * sizeof(uint32_t);
793+
written += hashwrite_be64(f, offset);
796794

797795
nr_large_offset--;
798796
}
@@ -980,8 +978,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
980978
chunk_offsets[i]);
981979

982980
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]);
985982

986983
written += MIDX_CHUNKLOOKUP_WIDTH;
987984
}

0 commit comments

Comments
 (0)