#include <iostream> template<int T> int TempFunc() { return 1 + TempFunc<T & (T-1)>(); } template<> int TempFunc<0>() { return 0; } int main() { std::cout << TempFunc<13>() << TempFunc<5>(); }
x&(x-1)
x == 01011000 (x-1) == 01010111 x&(x-1) == 01010000
Login in to like
Login in to comment
or Read more about C++ Quizzes
Login in to like
Login in to comment