I have two functions to convert Bit Position to Integer and back to Bit Position. The senior developer doesn't like that I use a loop for the IntegerToBitPosition function. Is there any way to make it better? I think it's okay, but he said "Just somebody like you could use a loop to calculate something." Only one bit can be set and if there's more than one bit set, it's okay to return the first one.
private int IntToBitPosition(int intValue)
{
  int bitValue = 1;
  if (intValue == bitValue)
  {
    return 0;
  }
  for (var bitPosition = 1; bitPosition < 32; i++)
  {
    bitValue *= 2;
    if (bitValue == intValue)
    {
       return bitPosition;
    }
  }
  return 0;
}
private int BitPositionToInt(int bitPosition)
{
  int intValue = 0;
  intValue |= 1 << bitPosition;
  return intValue;
}
 
     
     
     
    