Code: Select all

```
b = bitboard of pawns
increment = 8 or 16
uint8_t cas;
uint8_t casd;
switch (popcount(b)) {
case 8:
cas = lsb(b);
b &= b - 1;
casd = cas + increment;
ml->moviment = MakeMove(cas, casd);
ml++;
case 7:
cas = lsb(b);
b &= b - 1;
casd = cas + increment;
ml->moviment = MakeMove(cas, casd);
ml++;
case 6:
cas = lsb(b);
b &= b - 1;
casd = cas + increment;
ml->moviment = MakeMove(cas, casd);
ml++;
case 5:
cas = lsb(b);
b &= b - 1;
casd = cas + increment;
ml->moviment = MakeMove(cas, casd);
ml++;
case 4:
cas = lsb(b);
b &= b - 1;
casd = cas + increment;
ml->moviment = MakeMove(cas, casd);
ml++;
case 3:
cas = lsb(b);
b &= b - 1;
casd = cas + increment;
ml->moviment = MakeMove(cas, casd);
ml++;
case 2:
cas = lsb(b);
b &= b - 1;
casd = cas + increment;
ml->moviment = MakeMove(cas, casd);
ml++;
case 1:
cas = lsb(b);
casd = cas + increment;
ml->moviment = MakeMove(cas, casd);
ml++;
case 0:
return ml;
default: //> 8 pawns for strange games or positions
altremovpeo2 :
if (b == 0)
return ml;
cas = lsb(b);
casd = cas + increment;
ml->moviment = MakeMove(cas, casd);
ml++;
b &= b - 1;
goto altremovpeo2;
}
```