// the inverse of tt_adjust_score_for_hashtable score_t tt_adjust_score_for_hashtable(score_t score, int ply_in_search) { if (score >= win_in(MAX_PLY_IN_SEARCH)) { return score + ply_in_search; } if (score <= lose_in(MAX_PLY_IN_SEARCH)) { return score - ply_in_search; } return score; }
// when we insert score for a position into the hashtable, it does keeps the // pure score that does not account for which ply you are in the search tree; // when you retrieve the score from the hashtable, however, you want to // consider the value of the position based on where you are in the search tree score_t tt_adjust_score_from_hashtable(ttRec_t *rec, int ply_in_search) { score_t score = rec->score; if (score >= win_in(MAX_PLY_IN_SEARCH)) { return score - ply_in_search; } if (score <= lose_in(MAX_PLY_IN_SEARCH)) { return score + ply_in_search; } return score; }
static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct pcmcia_device *link; unsigned int irq; int ret; DPRINTK("mio_cs_attach(dev=%p,it=%p)\n", dev, it); link = cur_dev; /* XXX hack */ if (!link) return -EIO; dev->driver = &driver_ni_mio_cs; dev->iobase = link->io.BasePort1; irq = link->irq; printk("comedi%d: %s: DAQCard: io 0x%04lx, irq %u, ", dev->minor, dev->driver->driver_name, dev->iobase, irq); #if 0 { int i; printk(" board fingerprint:"); for (i = 0; i < 32; i += 2) { printk(" %04x %02x", inw(dev->iobase + i), inb(dev->iobase + i + 1)); } printk("\n"); printk(" board fingerprint (windowed):"); for (i = 0; i < 10; i++) printk(" 0x%04x", win_in(i)); printk("\n"); } #endif dev->board_ptr = ni_boards + ni_getboardtype(dev, link); printk(" %s", boardtype.name); dev->board_name = boardtype.name; ret = request_irq(irq, ni_E_interrupt, NI_E_IRQ_FLAGS, "ni_mio_cs", dev); if (ret < 0) { printk(" irq not available\n"); return -EINVAL; } dev->irq = irq; /* allocate private area */ ret = ni_alloc_private(dev); if (ret < 0) return ret; devpriv->stc_writew = &mio_cs_win_out; devpriv->stc_readw = &mio_cs_win_in; devpriv->stc_writel = &win_out2; devpriv->stc_readl = &win_in2; ret = ni_E_init(dev, it); if (ret < 0) return ret; return 0; }