All pastes #20770 Raw Edit

toMpEr

public cpp v1 · immutable
#20770 ·published 2005-08-22 19:14 UTC
rendered paste body
int stepsize( struct Block *b, int cpos) {    /*      * In the block b, what is the next character to check after cpos?     */        struct Peer *peer;    struct Request *req;    int step, i;    int minstep = b->end - cpos;    for (i=0; i< p->npeers; i++) {        peer = b->pset.peer[i];        for (j=0; j< peer->nreqs; j++) {	    req = peer->req[j];	    if ( cpos >= req->starts && cpos < req->end) {		step = req->end - cpos;		if (step < minstep) minstep = step;	    } else if (cpos < req->start) {		step = req->start - cpos;		if (step > 0 && step < minstep) minstep = step;	    }	}    }    return minstep;}