Skip to content

Commit

Permalink
5.9.8a Half sized bitboards
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Brausch committed Jun 6, 2021
1 parent 1410937 commit 78fa794
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/olithink.c
@@ -1,5 +1,5 @@
/* OliThink5 (c) Oliver Brausch 06.Jun.2021, ob112@web.de, http://brausch.org */
#define VER "5.9.8"
#define VER "5.9.8a"
#include <stdio.h>
#include <string.h>
#ifdef _WIN64
Expand Down Expand Up @@ -44,14 +44,14 @@ const int fval[] = {0, 0, 2, 0, 0, 3, 5, 9};
#define _CAP(x) ((x) << 19)
#define PREMOVE(f, p) ((f) | _ONMV(c) | _PIECE(p))

#define RATT1(f) rays[((f) << 7) | key000(BOARD, f)]
#define RATT2(f) rays[((f) << 7) | key090(BOARD, f) | 0x2000]
#define BATT3(f) rays[((f) << 7) | key045(BOARD, f) | 0x4000]
#define BATT4(f) rays[((f) << 7) | key135(BOARD, f) | 0x6000]
#define RXRAY1(f) rays[((f) << 7) | key000(BOARD, f) | 0x8000]
#define RXRAY2(f) rays[((f) << 7) | key090(BOARD, f) | 0xA000]
#define BXRAY3(f) rays[((f) << 7) | key045(BOARD, f) | 0xC000]
#define BXRAY4(f) rays[((f) << 7) | key135(BOARD, f) | 0xE000]
#define RATT1(f) rays[((f) << 6) | key000(BOARD, f)]
#define RATT2(f) rays[((f) << 6) | key090(BOARD, f) | 0x1000]
#define BATT3(f) rays[((f) << 6) | key045(BOARD, f) | 0x2000]
#define BATT4(f) rays[((f) << 6) | key135(BOARD, f) | 0x3000]
#define RXRAY1(f) rays[((f) << 6) | key000(BOARD, f) | 0x4000]
#define RXRAY2(f) rays[((f) << 6) | key090(BOARD, f) | 0x5000]
#define BXRAY3(f) rays[((f) << 6) | key045(BOARD, f) | 0x6000]
#define BXRAY4(f) rays[((f) << 6) | key135(BOARD, f) | 0x7000]

#define RMOVE1(f) (RATT1(f) & ~BOARD)
#define RMOVE2(f) (RATT2(f) & ~BOARD)
Expand Down Expand Up @@ -99,7 +99,7 @@ int wstack[0x400];

static u64 BIT[64];
static u64 hashxor[4096];
static u64 rays[0x10000];
static u64 rays[0x8000];
static u64 pmoves[128];
static u64 pcaps[384];
static u64 nmoves[64];
Expand Down Expand Up @@ -305,8 +305,8 @@ void _init_rays(u64* ray, u64 (*rayFunc) (int, u64, int), int (*key)(u64, int))
u64 occ = (*rayFunc)(f, board, 2);
u64 xray = (*rayFunc)(f, board, 3);
int index = (*key)(board, f);
ray[(f << 7) + index] = occ | move;
ray[(f << 7) + index + 0x8000] = xray;
ray[(f << 6) + index] = occ | move;
ray[(f << 6) + index + 0x4000] = xray;
}
}
}
Expand Down Expand Up @@ -396,18 +396,18 @@ int identPiece(int f) {
}

int key000(u64 b, int f) {
return (int) ((b >> (f & 56)) & 0x7E);
return (int) ((b >> ((f & 56) + 1)) & 0x3F);
}

int key090(u64 b, int f) {
u64 _b = (b >> (f&7)) & 0x0101010101010101LL;
_b = _b * 0x0080402010080400LL;
return (int)(_b >> 57);
return (int)(_b >> 58);
}

int keyDiag(u64 _b) {
_b = _b * 0x0202020202020202LL;
return (int)(_b >> 57);
return (int)(_b >> 58);
}

u64 bmask135[64], bmask45[64];
Expand Down Expand Up @@ -1412,9 +1412,9 @@ int main(int argc, char **argv) {
crevoke[56] ^= BIT[9];

_init_rays(rays, _rook0, key000);
_init_rays(rays + 0x2000, _rook90, key090);
_init_rays(rays + 0x4000, _bishop45, key045);
_init_rays(rays + 0x6000, _bishop135, key135);
_init_rays(rays + 0x1000, _rook90, key090);
_init_rays(rays + 0x2000, _bishop45, key045);
_init_rays(rays + 0x3000, _bishop135, key135);
_init_shorts(nmoves, _knight);
_init_shorts(kmoves, _king);
_init_pawns(pmoves, pcaps, pawnfree, pawnfile, pawnhelp, 0);
Expand Down

0 comments on commit 78fa794

Please sign in to comment.