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

2008-05-22 Thread Szabolcs Nagy
On 5/22/08, David Tweed [EMAIL PROTECTED] wrote: #define TAGMASK ((int)((1LL LENGTH(tags) + 1) - 1)) Incidentally, I think in the alphabet soup misdesign of C numeric constants, I suspect the code probably wants 1ULL and given long long is 64-bits and int is 32-bit on most 64-bit

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

2008-05-22 Thread David Tweed
On Thu, May 22, 2008 at 9:37 PM, Szabolcs Nagy [EMAIL PROTECTED] wrote: On 5/22/08, David Tweed [EMAIL PROTECTED] wrote: ..but (if eg int is 32 bit and we have 32 tags then) 132 is 0, and -1 is all ones in binary (guaranteed by the c standard) Ah, my mistake. I've spent too long writing 64-bit

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

2008-05-21 Thread Enno Gottox Boland
Here's my version of a bitarray patch. Please review and comment. 2008/5/20, yy [EMAIL PROTECTED]: 2008/5/20, Premysl Hruby [EMAIL PROTECTED]: 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.

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

2008-05-21 Thread Enno Gottox Boland
Hi! 2008/5/21, Szabolcs Nagy [EMAIL PROTECTED]: in config.h referencing tags has changed in rules but not in keys. Yes, arg has discussed yesterday if it's possible to change const char *arg to void *arg. if this works, i'll change the key behavior too. the (1 tagnum) in rules is a bit nasty

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

2008-05-21 Thread Premysl Hruby
On (21/05/08 08:27), Enno Gottox Boland wrote: To: dynamic window manager dwm@suckless.org From: Enno Gottox Boland [EMAIL PROTECTED] Subject: Re: [dwm] using bitaray for tags (PATCH) Reply-To: dynamic window manager dwm@suckless.org List-Id: dynamic window manager dwm.suckless.org Here's

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

2008-05-21 Thread Szabolcs Nagy
On 5/21/08, Enno Gottox Boland [EMAIL PROTECTED] wrote: the (1 tagnum) in rules is a bit nasty it is probably nicer to do the shifting in setup(); you mean in applyrules? - No I don't think so. It adds much more flexibility. You can define bitmasks as 0b10001 to tag a client to the first

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

2008-05-21 Thread Enno Gottox Boland
2008/5/21, Premysl Hruby [EMAIL PROTECTED]: tagmask can be #define: #define TAGMASK ((int)(1LL (LENGTH(tags) + 1) - 1)) Thanks! Here's the updated patch -- http://www.gnuffy.org - Real Community Distro http://www.gnuffy.org/index.php/GnuEm - Gnuffy on Ipaq (Codename Peggy) diff -r

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

2008-05-21 Thread Anselm R. Garbe
Hi I like your patches (also the version of anydot). On Wed, May 21, 2008 at 10:49:16AM +0200, Enno Gottox Boland wrote: 2008/5/21, Szabolcs Nagy [EMAIL PROTECTED]: in config.h referencing tags has changed in rules but not in keys. Yes, arg has discussed yesterday if it's possible to change

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

2008-05-21 Thread markus schnalke
Premysl Hruby [EMAIL PROTECTED] wrote: This is realization of Gottox's proposal discuted on IRC today. It handles tags not as Bool [], but as bit-array saved in int. I read, that bit-arrays are not very portable between different architectures. (It was in The practice of programming, I think)

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

2008-05-21 Thread Premysl Hruby
On (21/05/08 12:06), markus schnalke wrote: To: dwm@suckless.org From: markus schnalke [EMAIL PROTECTED] Subject: Re: [dwm] using bitaray for tags (PATCH) Mail-Followup-To: dwm@suckless.org User-Agent: Mutt/1.5.13 (2006-08-11) Reply-To: dynamic window manager dwm@suckless.org List-Id

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

2008-05-21 Thread Anselm R. Garbe
On Wed, May 21, 2008 at 12:14:27PM +0200, Premysl Hruby wrote: That's the reason why i wrote it as macros. That bitops can also be written as inline functions, without any harm to binary size or performance. And yes, with bitarrays there are some portability issues. But asside of limiting

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

2008-05-21 Thread Szabolcs Nagy
On 5/21/08, markus schnalke [EMAIL PROTECTED] wrote: I read, that bit-arrays are not very portable between different architectures. (It was in The practice of programming, I think) it's not exactly a bit array (arbitrary number of bits implemented eg. as char array), it's only one int (with bit

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

2008-05-21 Thread Premysl Hruby
On (20/05/08 11:22), Kurt H Maier wrote: To: dynamic window manager dwm@suckless.org From: Kurt H Maier [EMAIL PROTECTED] C has bitfield support inside structs: unsigned tagsapplied :8; and replace 8 with whatever value you want Not really with whatever value, only that values so whole

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

2008-05-21 Thread Enno Gottox Boland
Here is yet another update to the patch which includes chances discussed on #dwm. 2008/5/21, Anselm R. Garbe [EMAIL PROTECTED]: Hi I like your patches (also the version of anydot). On Wed, May 21, 2008 at 10:49:16AM +0200, Enno Gottox Boland wrote: 2008/5/21, Szabolcs Nagy [EMAIL

[dwm] using bitaray for tags (PATCH)

2008-05-20 Thread Premysl Hruby
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

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

2008-05-20 Thread Kurt H Maier
C has bitfield support inside structs: unsigned tagsapplied :8; and replace 8 with whatever value you want Bitfields are a bad idea imo; code has to be changed pretty severely to handle a varying-sized bitfield. You'd have to either limit the number of tags a user can create or else do a lot

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

2008-05-20 Thread Premysl Hruby
On (20/05/08 11:22), Kurt H Maier wrote: To: dynamic window manager dwm@suckless.org From: Kurt H Maier [EMAIL PROTECTED] Subject: Re: [dwm] using bitaray for tags (PATCH) Reply-To: dynamic window manager dwm@suckless.org List-Id: dynamic window manager dwm.suckless.org C has bitfield

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

2008-05-20 Thread Premysl Hruby
On (20/05/08 11:22), Kurt H Maier wrote: To: dynamic window manager dwm@suckless.org From: Kurt H Maier [EMAIL PROTECTED] Subject: Re: [dwm] using bitaray for tags (PATCH) Reply-To: dynamic window manager dwm@suckless.org List-Id: dynamic window manager dwm.suckless.org C has bitfield

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

2008-05-20 Thread yy
2008/5/20, Premysl Hruby [EMAIL PROTECTED]: 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