http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Least significant bit?



On Wed, 26 Jul 2000 11:18:11 +0000 (UTC) 
Lionel Pinkhard <lionelp@worldonline.co.za> wrote:

> Can somebody tell me how to check the least significant bit (bit
> 0) of a number?

Use a bit field:

  num & 0x1

> What I'm trying to do is only to check whether a given number is
> even or odd...

Use a modulo:

  num % 1 

-- 
J C Lawrence                                 Home: claw@kanga.nu
---------(*)                               Other: coder@kanga.nu
http://www.kanga.nu/~claw/        Keys etc: finger claw@kanga.nu
--=| A man is as sane as he is dangerous to his environment |=--
=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCꫨ please visit:
http://gameprogrammer.com/mailinglist.html