File:  [Research Unix] / researchv8dc / cmd / trace / trace6.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:59 2018 UTC (8 years, 3 months ago) by root
Branches: belllabs, MAIN
CVS tags: researchv8, HEAD
researchv8 Dan Cross

#include <stdio.h>
#include "trace.h"
#include "trace.d"

 extern int  *processes, *state, nrprocs, nrtbl;
 extern char mask[MAXPROC], althash;
 extern struct TBL *tbl;

 short *Factor;
 short maxr = 0;

inihash()
{ register int i;
  char *Smalloc();

	for (i = 0; i < nrtbl; i++)
		if (tbl[i].nrrows > maxr)
			maxr = tbl[i].nrrows;

	Factor = (short *)
		Smalloc(maxr * sizeof(short));

	for (i = 0; i < maxr; i++)
		Factor[i] = rand()%NOTOOBIG;	/* number between 0 and 16k */
}

hashvalue()
{ register int i, h;

	for (i = h = 0; i < nrprocs; i++)
	{	if (mask[i])
			continue;
		h = ((h << 2) | (h >> 13));	/* rotate */
		h ^= Factor[state[i]] ^ Factor[processes[i]];
	}

	return (h & NOTOOBIG);	/* return value will be stored in a short */
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.