Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBC] is this integer even or odd

Author
Message
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 7th Apr 2009 02:59
On occassion someone wants to figure out if an integer is even or odd:

the function


usage:



Enjoy your day.
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 7th Apr 2009 15:49
I've been wondering how to do this for a while.
I can't remember what it was I wanted to do with it though. hmm.. But I'm sure it was something important.

btw, it doesn't compile in U72 aww.. I so afraided.

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 8th Apr 2009 00:18
Quote: "btw, it doesn't compile in U72 aww.. I so afraided."


This snippet is for DBC, to make it compile in DBP change the & to &&.

Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 8th Apr 2009 14:05
Oh sorry, I didn't notice the [DBC] tag.

Lucy
17
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 10th Apr 2009 18:45
I was just looking at this and going "Considering it's DBC, I bet he's doing some convoluted math to get it done rather than simply checking the first bit in the integer." I'm pleasantly surprised

Everything I needed to know about trigonometry, I learned by becoming a game programmer.

Login to post a reply

Server time is: 2024-11-22 01:57:33
Your offset time is: 2024-11-22 01:57:33