c++ - Number of Elements in a long long. -


is there way number of element in long long in c++? example want count number of element in 0x993232bf, answer should 8. in advance.

int count_nibbles(long long n) {     int r=0;     while(n > 0)     {         n >>= 4;         r++;     }     return r; } 

or if prefer suggested in comments:

int count_nibbles(long long n) {    for(; n > 0; n >>= 4) r++;    return r; } 

Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -