すいません下桁からカウントしてです。で、自己解決したかもしれません。
int counter = 0;
int tempValue = targetValue;
if ((tempValue != 0)
{
  while((tempValue & 1ul)== 0)
  {
    tempValue >>= 1;
    counter++;
  }
}
これでシフトする必要がある桁数がわかるっぽいですね。