Optimize "Software-SPI-Slave-Mode" ISR

just a try to rewrite the ISR routine, it uses less statements
can you test it with SPI_CLOCK_DIV16

void _isrd2()
{
  byte rec = 0;
  byte bn = 1;
    
  while (~PIND & B00000100)           // while SS is LOW (PD2)
  {
    while ((PIND & B00100000) == 0) ; // wait for CLOCK HIGH

    if (PIND & B01000000)             // if Data HIGH  (PD6)
    {
      rec += bn;                      // add 1 bit  
    }
    bn = bn << 1;                     // shift to the next bit to receive

    while ((PIND & B00100000) == B00100000 ); // wait for CLOCK LOW
  }
  flag = rec;                         // set the flag value to the received byte
}