]> git.pond.sub.org Git - empserver/commit
Store sequence numbers more compactly
authorMarkus Armbruster <armbru@pond.sub.org>
Thu, 31 Dec 2009 09:30:54 +0000 (10:30 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 19 Jan 2010 07:31:10 +0000 (08:31 +0100)
commit358aee203eb7dfdcb633f2deea5323810ed32173
tree69e4dfaaf895dde1eacebf9f2b556e7587063db1
parentba2044be189f10349f4dba1bbe80c35ba0e81bae
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.
15 files changed:
include/commodity.h
include/empobj.h
include/file.h
include/game.h
include/land.h
include/loan.h
include/lost.h
include/nat.h
include/nuke.h
include/plane.h
include/sect.h
include/ship.h
include/trade.h
include/treaty.h
src/lib/subs/unitsub.c