mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Revert small pop_1st_bit() optimization
We cannot cast a pointer type to an unrelated pointer type. This is a violation of the strict aliasing rules. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
aa86d81f79
commit
3f14f9a478
1 changed files with 9 additions and 7 deletions
|
@ -348,19 +348,21 @@ union b_union {
|
|||
|
||||
Square pop_1st_bit(Bitboard* bb) {
|
||||
|
||||
b_union* u;
|
||||
b_union u;
|
||||
Square ret;
|
||||
|
||||
u = (b_union*)bb;
|
||||
u.b = *bb;
|
||||
|
||||
if (u->dw.l)
|
||||
if (u.dw.l)
|
||||
{
|
||||
ret = Square(BitTable[((u->dw.l ^ (u->dw.l - 1)) * 0x783a9b23) >> 26]);
|
||||
u->dw.l &= (u->dw.l - 1);
|
||||
ret = Square(BitTable[((u.dw.l ^ (u.dw.l - 1)) * 0x783a9b23) >> 26]);
|
||||
u.dw.l &= (u.dw.l - 1);
|
||||
*bb = u.b;
|
||||
return ret;
|
||||
}
|
||||
ret = Square(BitTable[((~(u->dw.h ^ (u->dw.h - 1))) * 0x783a9b23) >> 26]);
|
||||
u->dw.h &= (u->dw.h - 1);
|
||||
ret = Square(BitTable[((~(u.dw.h ^ (u.dw.h - 1))) * 0x783a9b23) >> 26]);
|
||||
u.dw.h &= (u.dw.h - 1);
|
||||
*bb = u.b;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue