]> git.ipfire.org Git - thirdparty/git.git/commitdiff
midx: use hashwrite_be64()
authorRené Scharfe <l.s.r@web.de>
Thu, 12 Nov 2020 12:22:16 +0000 (13:22 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 12 Nov 2020 17:40:08 +0000 (09:40 -0800)
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>
midx.c

diff --git a/midx.c b/midx.c
index 0de42ffdfb22c630e5b28f4997aa558c01a44d79..f56321dc8ceaa74c21d13316736ab9cc5b2ee11a 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -790,9 +790,7 @@ static size_t write_midx_large_offsets(struct hashfile *f, uint32_t nr_large_off
                if (!(offset >> 31))
                        continue;
 
-               hashwrite_be32(f, offset >> 32);
-               hashwrite_be32(f, offset & 0xffffffffUL);
-               written += 2 * sizeof(uint32_t);
+               written += hashwrite_be64(f, offset);
 
                nr_large_offset--;
        }
@@ -980,8 +978,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
                            chunk_offsets[i]);
 
                hashwrite_be32(f, chunk_ids[i]);
-               hashwrite_be32(f, chunk_offsets[i] >> 32);
-               hashwrite_be32(f, chunk_offsets[i]);
+               hashwrite_be64(f, chunk_offsets[i]);
 
                written += MIDX_CHUNKLOOKUP_WIDTH;
        }