I found online a nice algorithm for calculating the next highest power of 2. However, the algorithm takes a 32-bit integer. It seems to work just as well on 64-bit integers, but I'm not sure if it's guaranteed to always work. Will the following algorithm always return a 64-bit integer that is the next greatest power of 2?
uint64_t nextp2(uint64_t n)
n |= n >> 16;
n |= n >> 8;
n |= n >> 4;
n |= n >> 2;
n |= n >> 1;
Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.
I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…