Re(2): Stupid newbie question - determine if integer is even or odd
Re(2): Stupid newbie question - determine if integer is even or odd
- Subject: Re(2): Stupid newbie question - determine if integer is even or odd
- From: Jens Bauer <email@hidden>
- Date: Wed, 14 Aug 2002 01:46:47 +0200
Hi Steve and John,
On Tue, 13 Aug, 2002, Steve Bird <email@hidden> wrote:
>
> "These kids today don't know the simple joy of saving four bytes of
>
> page-0 memory on a 6502" - unknown
(I do, and I've done it recently; easter-egg in Opera.)
>
<Obsessed cycle-counter>
>
I'd just like to point out that even though everyone else who answered
>
this question did a mod , I did not see a single answer of
>
if (myVal & 0x1) {
>
}
Now, using bitwise AND is the correct way.
-The only way that one should use. It's short and fast, furthermore, you don't
run into problems with negaive values.
My vote for (value & 1) !
(Note: I find it kind of annoying that the subject-line sometimes goes
crazy like this:
"Re:_=3D=3FUS-ASCII=3FQ=3FRe:=5F=3D3D=3D3FWINDOWS-
1 252=3D3FQ=3D3FStupid=3D5Fnewbie=3D5
Fque_=3F=3D_stion=5F=3D97=5Fdetermine=5Fi???????Re:_=3D=3FUS-ASCII=3FQ=3F"
Is it some Webmail service that does this, or is it an email client ?
-Who can read that anyway ?)
Love,
Jens
--
Jens Bauer, Faster Software.
-Let's make the World better, shall we ?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.