ftp.nice.ch/pub/next/unix/developer/pcn.2.0.s.tar.gz#/src/sys/sys_hash.c

This is sys_hash.c in view mode; [Download] [Up]

/*
 * PCN System
 * Author:      Steve Tuecke
 *              Argonne National Laboratory
 *
 * Please see the DISCLAIMER file in the top level directory of the
 * distribution regarding the provisions under which this software
 * is distributed.
 *
 * sys_hash.c
 *
 * Foreign procedures used by sys.pcn
 */

#include "sys_internal.h"

/*
 * Produce a hash 'value' from the key string, 'key'.  The hash table
 * has 'n' buckets.
 */
void _p_sys_hash_key(n,key,value)
int_t *n;
char_t *key;
int_t *value;
{
    unsigned long y;
    int i;
    for (y = 0; i = (int)(*key++); )
    {
	y <<= 1;
	y += i;
    }
    *value = (int_t) (y % *n);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.