summaryrefslogtreecommitdiff
path: root/diffcore.h
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-01-16 20:22:56 -0500
committerJunio C Hamano <gitster@pobox.com>2014-01-17 10:50:13 -0800
commitb38f70a82b9628d80f5a9bc938a8861ee4dcf49e (patch)
tree9d4ae48c4496abafd7ca71b3595c318f5d89f0ad /diffcore.h
parent428d52a5a56f81d3a42871b51480cecafec58fdd (diff)
downloadgit-b38f70a82b9628d80f5a9bc938a8861ee4dcf49e.tar.gz
diff_filespec: reorder is_binary field
The middle of the diff_filespec struct contains a mixture of ints, shorts, and bit-fields, followed by a pointer. On an x86-64 system with an LP64 or LLP64 data model (i.e., most of them), the integers and flags end up being padded out by 41 bits to put the pointer at an 8-byte boundary. After the pointer, we have the "int is_binary" field, which is only 32 bits. We end up wasting another 32 bits to pad the struct size up to a multiple of 64 bits. We can move the is_binary field before the pointer, which lets the compiler store it where we used to have padding. This shrinks the top padding to only 9 bits (from the bit-fields), and eliminates the bottom padding entirely, dropping the struct size from 88 to 80 bytes. On a 32-bit system, there is no benefit, but nor should there be any harm (we only need 4-byte alignment there, so we were already using only 9 bits of padding). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore.h')
-rw-r--r--diffcore.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/diffcore.h b/diffcore.h
index 22993e1eff..d911bf0a42 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -45,9 +45,9 @@ struct diff_filespec {
#define DIRTY_SUBMODULE_MODIFIED 2
unsigned is_stdin : 1;
unsigned has_more_entries : 1; /* only appear in combined diff */
- struct userdiff_driver *driver;
/* data should be considered "binary"; -1 means "don't know yet" */
int is_binary;
+ struct userdiff_driver *driver;
};
extern struct diff_filespec *alloc_filespec(const char *);