4 * ----------------------------------------------------------------------
6 * Copyright (c) 2012 Free Software Foundation
8 * GNU SHOGI is based on GNU CHESS
10 * This file is part of GNU SHOGI.
12 * GNU Shogi is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 3 of the License,
15 * or (at your option) any later version.
17 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * You should have received a copy of the GNU General Public License along
23 * with GNU Shogi; see the file COPYING. If not, see
24 * <http://www.gnu.org/licenses/>.
25 * ----------------------------------------------------------------------
31 #if defined HAVE_GETTIMEOFDAY
39 /****************************************
40 * A variety of global flags.
41 ****************************************/
44 * If hard_time_limit is nonzero, exceeding the time limit means
48 short hard_time_limit = 1;
49 short barebones = 0; /* Suppress printing of statistics
50 * (mainly for xshogi). */
52 short nolist = 0; /* List the game after exit. */
54 short nolist = 1; /* Don't list the game after exit. */
58 * The default display type can be DISPLAY_RAW, DISPLAY_CURSES,
59 * or DISPLAY_X; the default is DISPLAY_X to make life easier for xshogi.
62 display_t display_type = DISPLAY_X;
64 unsigned int ttbllimit;
66 /* .... MOVE GENERATION VARIABLES AND INITIALIZATIONS .... */
69 #define max(a, b) (((a) < (b))?(b):(a))
70 #define odd(a) ((a) & 1)
73 const small_short piece_of_ptype[NO_PTYPE_PIECES] =
75 pawn, lance, knight, silver, gold, bishop, rook, pbishop, prook, king,
76 pawn, lance, knight, silver, gold
80 const small_short side_of_ptype[NO_PTYPE_PIECES] =
82 black, black, black, black, black, black, black, black, black, black,
83 white, white, white, white, white
87 const small_short psweep[NO_PTYPE_PIECES] =
89 false, true, false, false, false, true, true, true, true, false,
90 false, true, false, false, false
94 const small_short sweep[NO_PIECES] =
96 false, false, true, false, false, false, true, true,
97 false, false, false, false, true, true, false
101 #if !defined EXTLANGFILE
110 #include "gnushogi.lng"
122 * Determine the minimum number of moves for a piece from
123 * square "f" to square "t". If the piece cannot reach "t",
124 * the count is set to CANNOT_REACH.
127 #define csquare(sq) ((side == black) ? sq : (NO_SQUARES - 1 - sq))
128 #define crow(sq) row(csquare(sq))
129 #define ccol(sq) column(csquare(sq))
132 ptype_distance(short ptyp, short f, short t)
135 short colf, colt, rowf, rowt, dcol, drow;
140 piece = piece_of_ptype[ptyp];
141 side = side_of_ptype[ptyp];
143 dcol = (colt = ccol(t)) - (colf = ccol(f));
144 drow = (rowt = crow(t)) - (rowf = crow(f));
149 if ((dcol != 0) || (drow < 1))
155 if ((dcol != 0) || (drow < 1))
161 if (odd(drow) || (odd(drow / 2) != odd(dcol)))
163 else if ((drow == 0) || ((drow / 2) < abs(dcol)))
171 if (odd(drow) == odd(dcol))
173 return max(abs(drow), abs(dcol));
177 if (abs(dcol) <= drow)
180 return (max(abs(drow), abs(dcol)) + 1);
185 if (odd(drow) == odd(dcol))
186 return (max(abs(drow), abs(dcol)));
188 return (max(abs(drow) + 1, abs(dcol)) + 1);
199 return max(drow, abs(dcol));
201 return (abs(dcol) - drow);
204 if (odd(dcol) != odd(drow))
207 return ((abs(dcol) == abs(drow)) ? 1 : 2);
210 if (odd(dcol) != odd(drow))
212 if ((abs(dcol) <= 1) && (abs(drow) <= 1))
214 else if (abs(abs(dcol) - abs(drow)) == 1)
221 return ((abs(dcol) == abs(drow)) ? 1 : 2);
225 if ((dcol == 0) || (drow == 0))
231 if ((dcol == 0) || (drow == 0))
233 else if ((abs(dcol) == 1) && (abs(drow) == 1))
239 return max(abs(drow), abs(dcol));
242 /* should never occur */
243 return (CANNOT_REACH);
250 distance(short a, short b)
252 return (short)computed_distance(a, b);
256 distance(short a, short b)
259 ? (short)(*distdata)[(int)a][(int)b]
260 : (short)computed_distance(a, b));
265 #ifdef SAVE_PTYPE_DISTDATA
267 piece_distance(short side, short piece, short f, short t)
269 return ((f > NO_SQUARES)
271 : (short)ptype_distance(ptype[side][piece], f, t));
275 piece_distance(short side, short piece, short f, short t)
277 return ((f > NO_SQUARES)
279 : (use_ptype_distdata
280 ? (short)(*ptype_distdata[ptype[side][piece]])[f][t]
281 : (short)ptype_distance(ptype[side][piece], f, t)));
287 Initialize_dist(void)
289 short a, b, d, di, ptyp;
290 #ifndef SAVE_DISTDATA
291 for (a = 0; a < NO_SQUARES; a++)
293 for (b = 0; b < NO_SQUARES; b++)
295 d = abs(column(a) - column(b));
296 di = abs(row(a) - row(b));
297 (*distdata)[a][b] = (small_short)((d > di) ? d : di);
301 #ifndef SAVE_PTYPE_DISTDATA
302 for (ptyp = 0; ptyp < NO_PTYPE_PIECES; ptyp++)
304 for (a = 0; a < NO_SQUARES; a++)
305 for (b = 0; b < NO_SQUARES; b++)
306 (*ptype_distdata[ptyp])[a][b] = ptype_distance(ptyp, a, b);
313 * nextpos[piece][from-square], nextdir[piece][from-square] gives vector
314 * of positions reachable from from-square in ppos with piece such that the
317 * ppos = nextpos[piece][from-square];
318 * pdir = nextdir[piece][from-square];
325 * if(color[u] != neutral)
330 * will generate the sequence of all squares reachable from sq.
332 * If the path is blocked u = pdir[sq] will generate the continuation of the
333 * sequence in other directions.
338 * ptype is used to separate black and white pawns, like this; ptyp =
339 * ptype[side][piece] piece can be used directly in nextpos/nextdir when
340 * generating moves for pieces that are not white pawns.
343 const small_short ptype[2][NO_PIECES] =
346 ptype_no_piece, ptype_pawn, ptype_lance, ptype_knight,
347 ptype_silver, ptype_gold, ptype_bishop, ptype_rook,
348 ptype_gold, ptype_gold, ptype_gold, ptype_gold,
349 ptype_pbishop, ptype_prook, ptype_king
352 ptype_no_piece, ptype_wpawn, ptype_wlance, ptype_wknight,
353 ptype_wsilver, ptype_wgold, ptype_bishop, ptype_rook,
354 ptype_wgold, ptype_wgold, ptype_wgold, ptype_wgold,
355 ptype_pbishop, ptype_prook, ptype_king
359 const small_short promoted[NO_PIECES] =
361 no_piece, ppawn, plance, pknight, psilver, gold, pbishop, prook,
362 ppawn, plance, pknight, psilver, pbishop, prook, king
365 const small_short unpromoted[NO_PIECES] =
367 no_piece, pawn, lance, knight, silver, gold, bishop, rook,
368 pawn, lance, knight, silver, bishop, rook, king
371 const small_short is_promoted[NO_PIECES] =
373 false, false, false, false, false, false, false, false,
374 true, true, true, true, true, true, false
377 /* data used to generate nextpos/nextdir */
378 #if !defined SAVE_NEXTPOS
381 const small_short direc[NO_PTYPE_PIECES][8] =
383 { 11, 0, 0, 0, 0, 0, 0, 0 }, /* 0 ptype_pawn */
384 { 11, 0, 0, 0, 0, 0, 0, 0 }, /* 1 ptype_lance */
385 { 21, 23, 0, 0, 0, 0, 0, 0 }, /* 2 ptype_knight */
386 { 10, 11, 12, -12, -10, 0, 0, 0 }, /* 3 ptype_silver */
387 { 10, 11, 12, -1, 1, -11, 0, 0 }, /* 4 ptype_gold */
388 { 10, 12, -12, -10, 0, 0, 0, 0 }, /* 5 ptype_bishop */
389 { 11, -1, 1, -11, 0, 0, 0, 0 }, /* 6 ptype_rook */
390 { 10, 12, -12, -10, 11, -1, 1, -11 }, /* 7 ptype_pbishop */
391 { 11, -1, 1, -11, 10, 12, -12, -10 }, /* 8 ptype_prook */
392 { 10, 11, 12, -1, 1, -12, -11, -10 }, /* 9 ptype_king */
393 { -11, 0, 0, 0, 0, 0, 0, 0 }, /* 10 ptype_wpawn */
394 { -11, 0, 0, 0, 0, 0, 0, 0 }, /* 11 ptype_wlance */
395 { -21, -23, 0, 0, 0, 0, 0, 0 }, /* 12 ptype_wknight */
396 { -10, -11, -12, 12, 10, 0, 0, 0 }, /* 13 ptype_wsilver */
397 { -10, -11, -12, 1, -1, 11, 0, 0 }
398 }; /* 14 ptype_wgold */
401 small_short diagonal(short d)
403 return (abs(d) == 10 || abs(d) == 12);
407 static const small_short max_steps[NO_PTYPE_PIECES] =
409 1, 8, 1, 1, 1, 8, 8, 8, 8, 1, 1, 8, 1, 1, 1
413 const small_short nunmap[(NO_COLS + 2)*(NO_ROWS + 4)] =
415 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
416 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
417 -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, -1,
418 -1, 9, 10, 11, 12, 13, 14, 15, 16, 17, -1,
419 -1, 18, 19, 20, 21, 22, 23, 24, 25, 26, -1,
420 -1, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1,
421 -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, -1,
422 -1, 45, 46, 47, 48, 49, 50, 51, 52, 53, -1,
423 -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, -1,
424 -1, 63, 64, 65, 66, 67, 68, 69, 70, 71, -1,
425 -1, 72, 73, 74, 75, 76, 77, 78, 79, 80, -1,
426 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
427 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
431 const small_short inunmap[NO_SQUARES] =
433 23, 24, 25, 26, 27, 28, 29, 30, 31,
434 34, 35, 36, 37, 38, 39, 40, 41, 42,
435 45, 46, 47, 48, 49, 50, 51, 52, 53,
436 56, 57, 58, 59, 60, 61, 62, 63, 64,
437 67, 68, 69, 70, 71, 72, 73, 74, 75,
438 78, 79, 80, 81, 82, 83, 84, 85, 86,
439 89, 90, 91, 92, 93, 94, 95, 96, 97,
440 100, 101, 102, 103, 104, 105, 106, 107, 108,
441 111, 112, 113, 114, 115, 116, 117, 118, 119
445 int InitFlag = false;
448 #if defined SAVE_NEXTPOS
451 next_direction(short ptyp, short *d, short sq)
453 short delta, to, sfrom = inunmap[sq];
461 delta = direc[ptyp][*d];
465 to = nunmap[sfrom + delta];
474 next_position(short ptyp, short *d, short sq, short u)
476 if (*d < 4 && psweep[ptyp])
478 short to = nunmap[inunmap[u] + direc[ptyp][*d]];
481 return next_direction(ptyp, d, sq);
487 return next_direction(ptyp, d, sq);
493 first_direction(short ptyp, short *d, short sq)
496 return next_direction(ptyp, d, sq);
502 * This procedure pre-calculates all moves for every piece from every
503 * square. This data is stored in nextpos/nextdir and used later in the
504 * move generation routines.
508 Initialize_moves(void)
510 short ptyp, po, p0, d, di, s, delta;
511 unsigned char *ppos, *pdir;
515 short fpo = 23, tpo = 120;
517 for (ptyp = 0; ptyp < NO_PTYPE_PIECES; ptyp++)
519 for (po = 0; po < NO_SQUARES; po++)
521 for (p0 = 0; p0 < NO_SQUARES; p0++)
523 (*nextpos[ptyp])[po][p0] = (unsigned char)po;
524 (*nextdir[ptyp])[po][p0] = (unsigned char)po;
529 for (ptyp = 0; ptyp < NO_PTYPE_PIECES; ptyp++)
531 for (po = fpo; po < tpo; po++)
533 if (nunmap[po] >= (small_short)0)
535 ppos = (*nextpos[ptyp])[nunmap[po]];
536 pdir = (*nextdir[ptyp])[nunmap[po]];
538 /* dest is a function of direction and steps */
539 for (d = 0; d < 8; d++)
541 dest[d][0] = nunmap[po];
542 delta = direc[ptyp][d];
548 for (s = 0; s < max_steps[ptyp]; s++)
553 * break if (off board) or (promoted rooks
554 * wishes to move two steps diagonal) or
555 * (promoted bishops wishes to move two steps
558 if ((nunmap[p0] < (small_short)0)
559 || ((ptyp == ptype_prook)
562 || ((ptyp == ptype_pbishop)
564 && !diagonal(delta)))
567 dest[d][s] = nunmap[p0];
576 * Sort dest in number of steps order; currently no sort
577 * is done due to compatibility with the move generation
578 * order in old gnuchess.
583 for (di = d; s > 0 && di > 0; di--)
585 if (steps[sorted[di - 1]] == 0) /* should be: < s */
586 sorted[di] = sorted[di - 1];
595 * update nextpos/nextdir
599 pdir[p0] = (unsigned char)dest[sorted[0]][0];
601 for (d = 0; d < 8; d++)
603 for (s = 0; s < steps[sorted[d]]; s++)
605 ppos[p0] = (unsigned char)dest[sorted[d]][s];
606 p0 = dest[sorted[d]][s];
609 pdir[p0] = (unsigned char)dest[sorted[d + 1]][0];
612 * else is already initialized
626 * Reset the board and other variables to start a new game.
632 short l, c, p, max_opening_sequence;
633 #ifdef HAVE_GETTIMEOFDAY
636 compptr = oppptr = 0;
638 stage2 = -1; /* the game is not yet started */
639 flag.illegal = flag.mate = flag.post = flag.quit
640 = flag.reverse = flag.bothsides = flag.onemove = flag.force
642 flag.material = flag.coords = flag.hash = flag.easy
643 = flag.beep = flag.rcptr
645 flag.stars = flag.shade = flag.back = flag.musttimeout = false;
650 GenCnt = NodeCnt = et0 = dither = XCmore = 0;
659 MaxSearchDepth = MAXDEPTH - 1;
664 CptrFlag[0] = TesujiFlag[0] = false;
667 GameType[0] = GameType[1] = UNKNOWN;
668 Pscore[0] = Tscore[0] = (SCORE_LIMIT + 3000);
669 opponent = player = black;
672 for (l = 0; l < TREE; l++)
673 Tree[l].f = Tree[l].t = 0;
675 gsrand((unsigned int) 1);
679 for (c = black; c <= white; c++)
681 for (p = pawn; p <= king; p++)
683 for (l = 0; l < NO_SQUARES; l++)
685 (*hashcode)[c][p][l].key
686 = (((unsigned long) urand()));
687 (*hashcode)[c][p][l].key
688 += (((unsigned long) urand()) << 16);
689 (*hashcode)[c][p][l].bd
690 = (((unsigned long) urand()));
691 (*hashcode)[c][p][l].bd
692 += (((unsigned long) urand()) << 16);
693 #if SIZEOF_LONG == 8 /* 64-bit long i.e. 8 bytes */
694 (*hashcode)[c][p][l].key
695 += (((unsigned long) urand()) << 32);
696 (*hashcode)[c][p][l].key
697 += (((unsigned long) urand()) << 48);
698 (*hashcode)[c][p][l].bd
699 += (((unsigned long) urand()) << 32);
700 (*hashcode)[c][p][l].bd
701 += (((unsigned long) urand()) << 48);
707 for (c = black; c <= white; c++)
709 for (p = pawn; p <= king; p++)
711 for (l = 0; l < MAX_CAPTURED; l++)
713 (*drop_hashcode)[c][p][l].key
714 = (((unsigned long) urand()));
715 (*drop_hashcode)[c][p][l].key
716 += (((unsigned long) urand()) << 16);
717 (*drop_hashcode)[c][p][l].bd
718 = (((unsigned long) urand()));
719 (*drop_hashcode)[c][p][l].bd
720 += (((unsigned long) urand()) << 16);
721 #if SIZEOF_LONG == 8 /* 64-bit long i.e. 8 bytes */
722 (*drop_hashcode)[c][p][l].key
723 += (((unsigned long) urand()) << 32);
724 (*drop_hashcode)[c][p][l].key
725 += (((unsigned long) urand()) << 48);
726 (*drop_hashcode)[c][p][l].bd
727 += (((unsigned long) urand()) << 32);
728 (*drop_hashcode)[c][p][l].bd
729 += (((unsigned long) urand()) << 48);
736 for (l = 0; l < NO_SQUARES; l++)
738 board[l] = Stboard[l];
739 color[l] = Stcolor[l];
747 #ifdef HAVE_GETTIMEOFDAY
748 gettimeofday(&tv, NULL);
749 time0 = tv.tv_sec*100 + tv.tv_usec/10000;
751 time0 = time((long *) 0);
754 /* resetting reference time */
755 ElapsedTime(COMPUTE_AND_INIT_MODE);
756 flag.regularstart = true;
766 else if (MaxResponseTime == 0)
769 UpdateDisplay(0, 0, 1, 0);
771 GetOpeningPatterns(&max_opening_sequence);
784 hashbd = hashkey = 0;
791 Initialize_data(void)
803 ShowMessage("datatype 'small_short' is unsigned; "
804 "check gnushogi.h\n");
809 n = sizeof(struct leaf) * (size_t)TREE;
814 sprintf(buffer, "Cannot allocate %ld bytes for search tree",
820 n = sizeof(hashcode_array);
821 hashcode = malloc(n);
825 sprintf(buffer, "Cannot allocate %ld bytes for hashcode", (long)n);
830 n = sizeof(drop_hashcode_array);
831 drop_hashcode = malloc(n);
836 "Cannot allocate %ld bytes for drop_hashcode",
842 n = sizeof(struct GameRec) * (size_t)(MAXMOVES + MAXDEPTH);
843 GameList = malloc(n);
848 "Cannot allocate %ld bytes for game record",
854 #if !defined SAVE_NEXTPOS
855 n = sizeof(next_array);
857 for (i = 0; i < NO_PTYPE_PIECES; i++)
859 nextdir[i] = use_nextpos ? malloc(n) : NULL;
865 sprintf(buffer, "cannot allocate %ld space for nextdir %d",
874 nextpos[i] = use_nextpos ? malloc(n) : NULL;
880 sprintf(buffer, "cannot allocate %ld space for nextpos %d",
895 n = sizeof(value_array);
900 ShowMessage("cannot allocate value space");
904 n = sizeof(fscore_array);
909 ShowMessage("cannot allocate fscore space");
919 sprintf(buffer, "Cannot allocate %ld bytes for history table",
920 (long)sizeof_history);
927 n = sizeof(struct etable) * (size_t)ETABLE;
929 for (i = 0; i < 2; i++)
931 etab[i] = use_etable ? malloc(n) : 0;
935 sprintf(buffer, "Cannot allocate %ld bytes for cache table %ld",
948 n = sizeof(struct hashentry)*(ttblsize + rehash);
950 while (doit && ttblsize > MINTTABLE)
952 ttable[0] = malloc(n); /* FIXME: cast to the correct type. */
953 ttable[1] = ttable[0] ? malloc(n) : NULL;
955 if (!ttable[0] || !ttable[1])
963 ttblsize = ttblsize >> 1;
964 n = sizeof(struct hashentry) * (ttblsize + rehash);
972 if (ttblsize <= MINTTABLE)
979 /* CHECKME: is the precedence here correct? */
980 /* ttbllimit = ttblsize << 1 - ttblsize >> 2; */
981 ttbllimit = (ttblsize << 1) - (ttblsize >> 2);
985 sprintf(buffer, "Cannot allocate %ld bytes for transposition table",
988 ttable[0] = ttable[1] = NULL;
992 #if !defined SAVE_DISTDATA
993 n = sizeof(distdata_array);
994 distdata = malloc(n);
998 ShowMessage("cannot allocate distdata space...");
999 use_distdata = false;
1003 #if !defined SAVE_PTYPE_DISTDATA
1004 n = sizeof(distdata_array);
1006 for (i = 0; i < NO_PTYPE_PIECES; i++)
1008 ptype_distdata[i] = use_ptype_distdata ? malloc(n) : 0;
1010 if (!ptype_distdata[i])
1013 "cannot allocate %ld bytes for ptype_distdata %d...",
1015 use_ptype_distdata = false;
1024 #if defined EXTLANGFILE
1029 InitConst(char *lang)
1037 constfile = fopen(LANGFILE, "r");
1041 ShowMessage("NO LANGFILE");
1045 while (fgets(s, sizeof(s), constfile))
1052 for (q = &s[len]; q > &s[8]; q--)
1058 ShowMessage("{ error in cinstfile");
1064 if ((s[3] != ':') || (s[7] != ':') || (s[8] != '{'))
1066 sprintf(buffer, "Langfile format error %s", s);
1067 ShowMessage(buffer);
1079 if (strcmp(&s[4], lang))
1084 if ((entry < 0) || (entry >= CPSIZE))
1086 ShowMessage("Langfile number error");
1090 for (q = p = &s[9]; *p; p++)
1096 else if (*(p + 1) == 'n')
1105 if ((entry < 0) || (entry > 255))
1107 sprintf(buffer, "Langfile error %d\n", entry);
1108 ShowMessage(buffer);
1112 CP[entry] = (char *)GLOBAL_ALLOC((unsigned) strlen(&s[9]) + 1);
1114 if (CP[entry] == NULL)
1117 sprintf(buffer, "CP MALLOC, entry %d", entry);
1122 strcpy(CP[entry], &s[9]);
1131 InitConst(char *lang)
1139 constfile = fopen(LANGFILE, "r");
1143 ShowMessage("NO LANGFILE");
1147 while (fgets(s, sizeof(s), constfile))
1154 if ((len > 3) && (s[3] == ':') || (len > 7) && (s[7] == ':'))
1156 ShowMessage("old Langfile error");
1162 ShowMessage("length error in Langfile");
1166 for (q = &s[len]; q > &s[15]; q--)
1174 ShowMessage("\" error in Langfile");
1180 if ((s[6] != ':') || (s[10] != ':') || (s[15] != '"'))
1182 sprintf(buffer, "Langfile format error %s", s);
1183 ShowMessage(buffer);
1187 s[6] = s[10] = '\0';
1195 if (strcmp(&s[7], lang))
1198 entry = atoi(&s[3]);
1200 if ((entry < 0) || (entry >= CPSIZE))
1202 ShowMessage("Langfile number error");
1206 for (q = p = &s[16]; *p; p++)
1212 else if (*(p + 1) == 'n')
1221 if ((entry < 0) || (entry > 255))
1223 sprintf(buffer, "Langfile error %d\n", entry);
1224 ShowMessage(buffer);
1228 CP[entry] = (char *)GLOBAL_ALLOC((unsigned)strlen(&s[16]) + 1);
1230 if (CP[entry] == NULL)
1233 sprintf(buffer, "CP MALLOC, entry %d", entry);
1238 strcpy(CP[entry], &s[16]);
1252 gsrand(starttime = ((unsigned int)time((long *)0))); /* init urand */
1259 if (Initialize_data() != 0)
1262 #if defined EXTLANGFILE
1266 strcpy(ColorStr[0], CP[118]);
1267 strcpy(ColorStr[1], CP[119]);
1270 MaxResponseTime = 0;
1274 signal(SIGUSR1, TerminateSearch);
1295 #if !defined SAVE_NEXTPOS
1313 hashfile = fopen(HASHFILE, RWA_ACC);
1317 fseek(hashfile, 0L, SEEK_END);
1318 filesz = ftell(hashfile) / sizeof(struct fileentry) - 1 - MAXrehash;
1319 hashmask = filesz >> 1;
1320 hashbase = hashmask + 1;
1322 #endif /* HASHFILE */
1339 #endif /* HASHFILE */