From 970909c2a7803564f82ab1d3660d77ad6a44b68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 12 Nov 2020 13:23:10 +0100 Subject: pack-write: use hashwrite_be64() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Call hashwrite_be64() to write a 64-bit value instead of open-coding it using htonl() and hashwrite(). This shortens the code, gets rid of a buffer and several magic numbers, and makes the intent clearer. Signed-off-by: René Scharfe Signed-off-by: Junio C Hamano diff --git a/pack-write.c b/pack-write.c index a6cdb3c..4bdd44c 100644 --- a/pack-write.c +++ b/pack-write.c @@ -153,13 +153,10 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec while (nr_large_offset) { struct pack_idx_entry *obj = *list++; uint64_t offset = obj->offset; - uint32_t split[2]; if (!need_large_offset(offset, opts)) continue; - split[0] = htonl(offset >> 32); - split[1] = htonl(offset & 0xffffffff); - hashwrite(f, split, 8); + hashwrite_be64(f, offset); nr_large_offset--; } } -- cgit v0.10.2-6-g49f6