[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gawk compl()
From: |
Stepan Kasal |
Subject: |
Re: gawk compl() |
Date: |
Mon, 10 Oct 2005 17:07:26 +0200 |
User-agent: |
Mutt/1.4.1i |
Hello,
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
...
> So, in fact, the calculation is being done with 64 bits.
> Therefore ~0xFFFF0000 = 0xFFFFFFFF0000FFFF. This is
> then converted to floating point and gets truncated
> in the process.
I have to admit I still don't understand how 0xffffffff0000ffff
becomes 0x1fffff0000ffff.
Could you please explain it?
> 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()...
Well, it is confusing if you print the result.
But it is useful when used as
bong_flag = 0x80
flags = flags & compl(bong_flags)
And I guess this is the reason for compl().
Stepan