You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
/** returns if "a" is a power of 2. Behaviour is undefined for floats,doubles and bools*/
template <class T>
inline bool isPowOf2(T a)
{
return ((a-1) & a) == 0; // 01000 - 00001 = 00111 ... 00111 & 01000 = 0
}
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
/** returns if "a" is a power of 2. Behaviour is undefined for floats,doubles and bools*/
template <class T>
inline bool isPowOf2(T a)
{
return ((a-1) & a) == 0; // 01000 - 00001 = 00111 ... 00111 & 01000 = 0
}
yes that class threat both 0 and 1 as power of 2. because in integers number dominion:
2^-inf
is still 0 and a so 0 is a power of 2 (and a power of any other number) and i think is correct. If you prefer to put into irrlicht that 0 is not a power of 2 just document it
but AFAIK with integers is correct that 0 is a power of any number to -inf.
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
I would say 0 is not a valid power of 2 as negative infinite isn't an integer number, but I guess as long as it's documented what it results in it probably doesn't matter anyway for the cases in which it will be used :-)
Isn't this just defined on unsigned anyway? So why bother with the template when we can simply add a version taking u32 and avoiding all those cases where a user implements an undefined behavior?
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
maybe you mean.. "nearestUpperPOT2 or "nearestLowerPOT2"?
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me