Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
fgm
#include <iostream> #include <chrono> int count_leading_zero(const unsigned int x) { return __builtin_clz(x); } int count_leading_zero(const unsigned long x) { return __builtin_clzl(x); } int count_leading_zero(const unsigned long long x) { return __builtin_clzll(x); } int main() { volatile std::uint32_t x = 1 << 30; volatile std::uint32_t y; std::cout << count_leading_zero(x) << '\n'; const auto t1 = std::chrono::steady_clock::now().time_since_epoch().count(); for(int i = 0; i < 1000000; ++i) y = count_leading_zero(x); const auto t2 = std::chrono::steady_clock::now().time_since_epoch().count(); std::cout << (t2-t1)/1000000.0; (void)y; }
run
|
edit
|
history
|
help
0
SOS DP
Float
data locality - fast example
const example
CPP - Ex 5
Address Book
Radix
sysTest.cpp
List add
Projekt misker