What's the fastest way to test if a number is odd number?
function isOddNumber(value:Number):Number
{
//--> your test here
}
Here is my version: The idea is by checking if the lowest bit of the number is set
function isOddNumber(value:Number):Number
{
return (value & 1 == 1);
}
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home