This line of code for setting the e.p. bit for a white pawn move works.
p16 = (u64)(mts - mfs == 16) << (mfs + 8);
So for e2e4 this equates as 1ull << 20 which is correct.
However, for c7c5 this line of code does not work.
p16 = (u64)(mfs - mts == 16) << (mfs - 8);
It equates to 0ull << 42 which is incorrect.
I made sure that mfs and mts were correct in both cases. c7 50 and c5 34, (50 - 34 == 16) = true = 1.
It has to be a debugger error?
Thanks
Debugger error or Programmer error?
Moderators: hgm, Rebel, chrisw
-
- Posts: 880
- Joined: Fri Aug 21, 2020 1:25 am
- Location: Planet Earth, Sol system
- Full name: Michael J Sherwin
-
- Posts: 880
- Joined: Fri Aug 21, 2020 1:25 am
- Location: Planet Earth, Sol system
- Full name: Michael J Sherwin
Re: Debugger error or Programmer error?
std::cout << mfs - mts << "\n";
p16 = (u64)(mfs - mts == 16) << (mfs - 8);
std::cout << p16 << "\n";
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B Q K B N R
e2e4
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . P . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R
c7c5
16
0
p16 = (u64)(mfs - mts == 16) << (mfs - 8);
std::cout << p16 << "\n";
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B Q K B N R
e2e4
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . P . . .
. . . . . . . .
P P P P . P P P
R N B Q K B N R
c7c5
16
0
-
- Posts: 880
- Joined: Fri Aug 21, 2020 1:25 am
- Location: Planet Earth, Sol system
- Full name: Michael J Sherwin
Re: Debugger error or Programmer error?
std::cout << mts - mfs << "\n";
p16 = (u64)(mts - mfs == 16) << (mfs + 8);
std::cout << p16 << "\n";
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B Q K B N R
e2e4
16
1048576 (0X100000)
p16 = (u64)(mts - mfs == 16) << (mfs + 8);
std::cout << p16 << "\n";
r n b q k b n r
p p p p p p p p
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
P P P P P P P P
R N B Q K B N R
e2e4
16
1048576 (0X100000)
-
- Posts: 880
- Joined: Fri Aug 21, 2020 1:25 am
- Location: Planet Earth, Sol system
- Full name: Michael J Sherwin
Re: Debugger error or Programmer error?
It was programmer error,
s32 p16; I could have sworn I made that a u64.
s32 p16; I could have sworn I made that a u64.