summaryrefslogtreecommitdiff
path: root/src/chess.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/chess.h')
-rwxr-xr-xsrc/chess.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/chess.h b/src/chess.h
index 062e3dc..5e1d4a5 100755
--- a/src/chess.h
+++ b/src/chess.h
@@ -162,7 +162,7 @@ typedef struct _DLIST_ENTRY
#endif
#ifndef CONTAINING_STRUCT
#define CONTAINING_STRUCT(address, type, field) \
- ((type *)((BYTE *)(address) - (OFFSET_OF(field, type))))
+ ((type *)((BYTE *)(address) - (BYTE *)(OFFSET_OF(field, type))))
#endif
#define WHITE (1)
@@ -189,7 +189,6 @@ typedef struct _DLIST_ENTRY
#define THREE_PLY 192
#define FOUR_PLY 256
#define MAX_DEPTH_PER_SEARCH (MAX_PLY_PER_SEARCH * ONE_PLY)
-#define MAX_EXTEND_PER_LINE (MAX_PLY_PER_SEARCH * ONE_PLY / 2)
#define IS_VALID_DEPTH(x) (((x) >= 0) && \
((x) <= MAX_DEPTH_PER_SEARCH) && \
@@ -521,7 +520,7 @@ typedef union _MOVE
((mv).uMove & 0x0FF00000)
#define IS_ENPASSANT(mv) \
- (IS_SPECIAL_MOVE(mv) && (mv.pCaptured) && !IS_PROMOTION(mv))
+ (IS_SPECIAL_MOVE(mv) && ((mv).pCaptured) && !IS_PROMOTION(mv))
#define IS_DOUBLE_JUMP(mv) \
(IS_SPECIAL_MOVE(mv) && !IS_CAPTURE_OR_PROMOTION(mv))
@@ -1206,7 +1205,13 @@ _assert(CHAR *szFile, ULONG uLine);
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
-#ifdef _X86_
+#if defined(_X86_) || defined(_X64_)
+//
+// Note: these are 32-bit int bit tricks, not actually x86-specific --
+// they only require sizeof(int) == 4, which still holds under the LP64
+// data model used by 64-bit (_X64_) builds. Gated on both so a SIXTYFOUR
+// build (which defines _X64_, not _X86_) still gets the branchless
+// versions instead of falling through to the plain-C fallbacks below.
//
// Note: MAXU, MINU and ABS_DIFF require arguments with the high order
// bit CLEAR to work right.
@@ -1236,7 +1241,7 @@ _assert(CHAR *szFile, ULONG uLine);
#define ABS_DIFF(a, b) \
(((b)-(a)) - ((((b) - (a)) & (((int)((b) - (a))) >> 31) ) << 1))
-#endif // _X86_
+#endif // _X86_ || _X64_
#ifndef MINU
#define MINU(x, y) (MIN((x), (y)))
@@ -1255,7 +1260,7 @@ _assert(CHAR *szFile, ULONG uLine);
#endif
#ifndef ABS_DIFF
-#define ABS_DIFF(a, b) (abs((int)(a) - (int)(b)))
+#define ABS_DIFF(a, b) (abs((a) - (b)))
#endif
#define FILE_DISTANCE(a, b) (ABS_DIFF(FILE((a)), FILE((b))))
@@ -1746,14 +1751,8 @@ void
SlidePiece(POSITION *pos, COOR cFrom, COOR cTo);
void
-SlidePieceWithoutSigs(POSITION *pos, COOR cFrom, COOR cTo);
-
-void
SlidePawn(POSITION *pos, COOR cFrom, COOR cTo);
-void
-SlidePawnWithoutSigs(POSITION *pos, COOR cFrom, COOR cTo);
-
PIECE
LiftPiece(POSITION *pos, COOR cSquare);