This loop realizes Log_base_2 of an integer value, at the end the result is available in the variable i
.
Why does a shift of the form valor >> 1
have no effect compared to valor = valor >> 1
which by the way was the way I managed to avoid an loop / p>
for(i = 0 ; valor != 1 ; valor >> 1, ++ i); //loop infinito
for(i = 0 ; valor != 1 ; valor = valor >> 1, ++ i); //execução normal