Re: Stupid newbie question - determine if integer is even or odd
Re: Stupid newbie question - determine if integer is even or odd
- Subject: Re: Stupid newbie question - determine if integer is even or odd
- From: Heather Donahue <email@hidden>
- Date: Tue, 13 Aug 2002 17:17:43 -0700
On 8/13/02 4:28 PM, "Steve Bird" <email@hidden> wrote:
>
<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) {
>
}
>
>
--- ANDing is most often faster than division. It pains me to see a
>
division whose result (quotient) is discarded. That's just cruel. There
>
IS such a thing as the Society for the Prevention of Cruelty to Computers,
>
you know.
Maybe I'm being pedantic, and possibly even wrong, but doesn't the ANDing
method assume you know the internal bitwise representation of the variable?
_______________________________________________
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.