Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: (PR#8584) remove dio_[put|get]_city_map
Home

[Freeciv-Dev] Re: (PR#8584) remove dio_[put|get]_city_map

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#8584) remove dio_[put|get]_city_map
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 25 Apr 2004 14:15:44 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8584 >

Raimar Falke wrote:

> Do you want
> 
> type UINT16           = uint16(uint2)

No.  I want a type uint2 that is a 2-bit integer (along with uint1 and 
maybe others).  The packet code knows that 4 uint2s can be packed into a 
uint8.  So if you have an array

UINT2 city_map[25];

it will only take 7 bytes instead of 25.

A uint1 is equivalent to a boolean so in a way this is a generalization 
of (presumably) the existing boolean special-case.

Slightly more advanced:

   UINT1 value1;
   UINT2 value2;
   UINT4 value3;

need only take 1 byte.

The concept of alignment may come into play here.  A uint1, uint2, uint4 
need only be aligned to the bit.  A uint8 or greater is aligned to the byte.

jason




[Prev in Thread] Current Thread [Next in Thread]