[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gawk compl()
From: |
Andrew J. Schorr |
Subject: |
Re: gawk compl() |
Date: |
Mon, 10 Oct 2005 09:45:44 -0400 |
User-agent: |
Mutt/1.4.1i |
On Mon, Oct 10, 2005 at 09:29:55AM -0400, Andrew J. Schorr wrote:
> On Mon, Oct 10, 2005 at 02:19:49PM +0200, Karel Zak wrote:
> > $ gawk 'BEGIN {printf("%#x\n", compl(0xFFFF0000)) }'
> > 0x1fffff0000ffff
> At the moment, all of the bitwise operators seem to be
> implemented using uintmax_t. This is not really problematic
> for the other operators, but it is certainly confusing
> for compl()...
The best solution is probably to avoid using compl. Try
this instead:
gawk 'BEGIN {printf("%x\n", xor(0xFFFF0000,lshift(1,32)-1))}'
By using xor and lshift, one avoids relying on assumptions
about gawk internals...
Regards,
Andy