Skip to content

Commit f25ed09

Browse files
Daniel WhiteDaniel White
authored andcommitted
Removed brackets and used bitwise (single character) operators where possible (instead of double character logical versions). Saved 11 bytes.
1 parent 3b89241 commit f25ed09

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

iota.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ D(x, y, p, e) {
1515
F i=T[(m=B[f])&7]-35,d=0;d<0 || (d=T[i++]-35);d=-d) { // Loop over move steps for this piece.
1616
F t=f;m&S;) { // Loop over destination squares in this direction.
1717
// Illegal square or friendly capture?
18-
I (t+=d)&(b=136) || (v=B[t])&S K
18+
I (t+=d)&(b=136) | (v=B[t])&S K
1919

2020
// Special pawn logic.
2121
I m%8==2)
2222
{
23-
I ((d>0)^(S==32)) || // Bad direction?
24-
(!v && d%2 && t!=e) | // Diagonal without capture?
25-
!(d%2 || !v) // Straight with capture?
23+
I (d>0 ^ S==32) | // Bad direction?
24+
(!v & d%2 & t!=e) | // Diagonal without capture?
25+
!(d%2 | !v) // Straight with capture?
2626
K
2727

2828
I t==e) b=t^16; // Is this an en-passent capture?
@@ -35,7 +35,7 @@ D(x, y, p, e) {
3535
// Make move.
3636
B[t]=m%128;
3737
B[f]=B[b]=0; // If en-passent capture, remove victim pawn.
38-
I m%8==2 & (t<8 || t>103))
38+
I m%8==2 & (t<8 | t>103))
3939
B[t]^=T[p%7+31]-35; // Promotion.
4040
S^=96;
4141
I m&16 && t!=f+d)
@@ -59,7 +59,7 @@ D(x, y, p, e) {
5959
continue;
6060

6161
// Hit a piece or non-slider?
62-
I v || m&8 K
62+
I v | m&8 K
6363
}
6464
}
6565
}

0 commit comments

Comments
 (0)