[Freeciv-Dev] Re: (PR#2521) general effects framework
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Mike Kaufman via RT wrote:
> On Mon, Jan 13, 2003 at 03:30:12PM -0800, Jason Short via RT wrote:
>
>>Mike Kaufman via RT wrote:
>>
>>>On Mon, Jan 13, 2003 at 03:46:59AM -0800, Ben Webb via RT wrote:
>>
>>>>Speed cost? I'd imagine it'd be faster if anything. (By bitfield, I mean
>>>>that defined in the C language - e.g. int active:1; int pending:1 etc.)
>>>
>>>
>>>I'll do this.
>>
>>I'm strongly opposed to that. These values are boolean, and that's what
>>'bool' is for. If you think there's an advantage to it, instead change
>>fc_bool to this type.
>
>
> that's silly. the point here is that we've got eight booleans here. Since
> we have lots of effects in an average-sized game, It makes sense to stick
> all these into one byte instead of having eight bytes if fc_bool were
> sizeof(char) or 64 bytes since fc_bool is an unsigned int right now.
>
> changing fc_bool to this would be useless as it'll use the same amount of
> memory, and annoying, since you'd have to call into a struct to retrieve
> your bool.
It's too bad you can't do
typedef int fc_bool : 1;
as I had envisioned. It seems this won't work...
So I suggest
bool active : 1;
instead.
jason
|
|