Esempio n. 1
0
File: show.c Progetto: sergiy8/fsha
int main(int argc, char ** argv){
	int i,j;
	b = getarg(1);
	w = getarg(2);
	d = getarg(3);
	printf("%08X %X %X\n",b,w,d);
	while(b) {
		int i = _ffs(b)-1;
		pole[i] = w&1? 'w' : 'b';
		if(d&1) pole[i] ^= 0x20;
//printf("%d %c\n",i,pole[i]);
		w/=2;
		d/=2;
		b&=b-1;
	}
	for(i=0;i<8;i++) {
		if((i&1)==0) printf("  ");
		for(j=0;j<4;j++){
		   int k = (28-4*i) + j;
		   printf(" %c ",pole[k]?pole[k]:'.');
		}
		printf("\n");
	}
	return 0;
}
Esempio n. 2
0
/* Removes the tack 'tcb' from the RDYQUE 'rq'.
 */
void
ready_queue_delete(RDYQUE *rq,TCB *tcb)
	{
	INT		i, priority;

	/* Remove the task 'tcb' from the associated FIFO (for that priority).
	   However, it that task is the only element at that priority then
	   the 'bitmap' field must be adjusted.
	*/
	priority = tcb->priority;
	queue_delete(&(tcb->tskque));
	if ( !queue_empty_p(&(rq->tskque[priority])) )
		return;
	bitmap_clear(rq, priority);
	if ( priority!=rq->top_priority )
		return;

	/* This section of the code deals with the case where the highest
	   priority task was removed and as a result, the 'top_priority'
	   field must be updated.
	*/
	for ( i=priority/BITMAPSZ;i<NUM_BITMAP;i++ )
		{
		if ( rq->bitmap[i] )
			{
			rq->top_priority = i * BITMAPSZ + _ffs(rq->bitmap[i]);
			return;
			}
		}
	rq->top_priority = NUM_PRI;
	}