git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dilyan Palauzov <dilyan.palauzov@aegee.org>
To: git@vger.kernel.org
Subject: Avoid padding in structs index_state, packed_git
Date: Tue, 18 Aug 2015 12:55:43 +0200	[thread overview]
Message-ID: <55D30F2F.4070907@aegee.org> (raw)

On 64 bit linux, sizeof (struct index_state) = 160 and sizeof (struct 
packed_git) = 104.  This change shrinks the structs with 8bytes (as it 
avoids padding)

Signed-off-by: Дилян Палаузов <git-dpa@aegee.org>
---
diff --git a/cache.h b/cache.h
index 6bb7119..e00908b 100644
--- a/cache.h
+++ b/cache.h
@@ -310,11 +310,11 @@ struct index_state {
         struct cache_tree *cache_tree;
         struct split_index *split_index;
         struct cache_time timestamp;
-       unsigned name_hash_initialized : 1,
-                initialized : 1;
         struct hashmap name_hash;
         struct hashmap dir_hash;
         unsigned char sha1[20];
+       unsigned name_hash_initialized : 1,
+                initialized : 1;
         struct untracked_cache *untracked;
  };

@@ -1192,8 +1192,8 @@ extern struct packed_git {
         uint32_t num_objects;
         uint32_t num_bad_objects;
         unsigned char *bad_object_sha1;
-       int index_version;
         time_t mtime;
+       int index_version;
         int pack_fd;
         unsigned pack_local:1,
                  pack_keep:1,

                 reply	other threads:[~2015-08-18 11:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D30F2F.4070907@aegee.org \
    --to=dilyan.palauzov@aegee.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).