Store sequence numbers more compactly
Store them and ef_type in bit-fields. Allocate eight bits for ef_type. Values range from 0 to EF_GAME (currently 16), so this is plenty. Allocate twelve bits for sequence numbers. Sequence number mismatches are now missed when the numbers are equal modulo 2^12. Still sufficiently improbable. Common machines store the bit-fields in a 32 bit word. There are twelve bits left in that word for future use. Total savings 16 bits, which is exactly what the previous commit spent on wider uids on common machines.
This commit is contained in:
parent
ba2044be18
commit
358aee203e
15 changed files with 33 additions and 34 deletions
|
@ -49,9 +49,9 @@
|
|||
|
||||
struct lndstr {
|
||||
/* initial part must match struct empobj */
|
||||
short ef_type;
|
||||
signed ef_type: 8;
|
||||
unsigned lnd_seqno: 12;
|
||||
int lnd_uid; /* unit id (land #) */
|
||||
unsigned lnd_seqno;
|
||||
time_t lnd_timestamp; /* Last time this unit was touched */
|
||||
natid lnd_own; /* owner's country num */
|
||||
coord lnd_x; /* x location in abs coords */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue