develooper Front page | perl.fwp | Postings from January 2002

Re: solutions

Thread Previous | Thread Next
Bart Lateur
January 29, 2002 01:11
Re: solutions
Message ID:
On Mon, 28 Jan 2002 22:05:47 -0500, Rick Myers wrote:

>> > ~$. is odd if $. is even
>> What is this?  Tell me more, I'm lost.
>I didn't get that part myself...

Bitwise "not" will invert all bits, including the lowest one. So this
test for even/odd will return complementary results in this case.

In 2's complement, bitwise not on 1 will return -2, bitwise not on 2
will return -3. The sum is always -1 (all bits set).


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About