[Freeciv-Dev] Re: [RFC] x & (1u << y)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Raimar Falke wrote:
> There are a lot of constructs like "x & (1u << y)" in the code:
> - city options, flags and roles
> - shared vision
> - embassy
> - claims
> - gotohand
> - known and sent in maphand
>
> These all are used as a bool but aren't a bool. Should they be wrapped
> with BOOL_VAL, a new test_bit or with functions specific to the
> domains above?
>
> Raimar
Why not change the flags to structs like
struct foo {
int can_build_t1 : 1; /* This is a one bit int (0 | 1) */
int can_build_t2 : 1;
....
}
then you can use .
if (foo_var.can_build_t1 == TRUE) ....
etc..
It should make code more readable than "x & (1u << y)"
???
|
|