Re: [dwm] using bitaray for tags (PATCH)

From: yy <yiyu.jgl_AT_gmail.com>
Date: Tue, 20 May 2008 19:14:44 +0200

2008/5/20, Premysl Hruby <dfenze_AT_gmail.com>:
> Hi,
>
> This is realization of Gottox's proposal discuted on IRC today.
> It handles tags not as Bool [], but as bit-array saved in int.
>
> There's only one problem, as I don't find easy solution (in compile time)
> for check if there's no more tags than sizeof(int)*8.
>
> Maybe it can be "asserted" with someting like (possibly global, compiler
> take it away as it's not used anywhere):
>
> static char too_many_tags_test[sizeof(int)*8 - LENGTH(tags)];
>
> Has anyone better solution?
>
> -Ph
>
> --
> Premysl "Anydot" Hruby, http://www.redrum.cz/
>
>

But, why so many macros? I don't see TMASK(p) better than 1 << (p),
the same with TOGGLE and ISSET, and I don't understand SET at all, you
are not using the v for anything (it is always 1), why not t = 1 <<
(p) ?
And about the int size, I think that since tags are defined in source
code it shouldn't be a problem.
The only problem I see is that the style doesn't fit too much with the
rest of the dwm code, but global Bools could also be changed to a
global bitarray with some Enum.

-- 
- yiyus || JGL .
Received on Tue May 20 2008 - 19:14:46 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:42:40 UTC