diff options
author | Karsten Blees <karsten.blees@gmail.com> | 2013-12-07 20:56:32 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-02-24 15:26:46 -0800 |
commit | 0e5b77af2c0f6253025afbdb77aff38a02e30602 (patch) | |
tree | b5ea498eb757c4bf63f819bd436349bc892ba90f | |
parent | 7b359ea6b3333a87fd3fa8b84913f2b75ed244ad (diff) | |
download | git-kb/fast-hashmap-pack-struct.tar.gz |
hashmap.h: make sure map entries are tightly packedkb/fast-hashmap-pack-struct
Extending 'struct hashmap_entry' with an int-sized member shouldn't waste
memory on 64-bit systems. This is already documented in api-hashmap.txt,
but needs '__attribute__((__packed__))' to work.
Reduces e.g.
struct name_entry {
struct hashmap_entry ent;
int namelen;
char *name;
};
from 32 to 24 bytes.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | hashmap.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -15,7 +15,7 @@ extern unsigned int memihash(const void *buf, size_t len); /* data structures */ -struct hashmap_entry { +struct __attribute__((__packed__)) hashmap_entry { struct hashmap_entry *next; unsigned int hash; }; |