Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

number is a power of 2

bool IsPowerOfTwo(ulong x)
{
    return (x != 0) && ((x & (x - 1)) == 0);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #number #power
ADD COMMENT
Topic
Name
8+9 =