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

From: Szabolcs Nagy <nszabolcs_AT_gmail.com>
Date: Thu, 22 May 2008 22:37:27 +0200

On 5/22/08, David Tweed <david.tweed_AT_gmail.com> 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 Linux platforms I don't
> understand the cast here.

imho the LL (and the + 1 ?) is not needed

i guess the purpose of the LL here was to make sure it works for the
"all ones" case
(so it was enough that long long has at least one more bits than int,
the signedness does not matter)

..but (if eg int is 32 bit and we have 32 tags then) 1<<32 is 0, and
-1 is "all ones" in binary (guaranteed by the c standard)
Received on Thu May 22 2008 - 22:37:29 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:43:49 UTC