/************************************************************************
 *                                                                    	*
 *                      Copyright (c) 1989, 1990                       	*
 *                     MasPar Computer Corporation                      *
 *                         All Rights Reserved                     	*
 *                                                                	*
 * This program contains proprietary and trade secret information of	*
 * MasPar Computer Corporation and has been licensed subject to 	*
 * restrictions on reproduction, use and disclosure.  The copyright 	*
 * notice does not imply that the program or the related ideas or 	*
 * algorithms are in the public domain.                                 *
 ************************************************************************/
#include <mpl.h>

#define IDENT	0				/* the IDENTITY for addition */

int
reduceAdd32(src)
register plural int src;
{
    register plural int active;			/* determines active set */

    all active = 0;
    active = 1;

    all {
        register int d;				/* the shift distance */

	if (!active) src = IDENT;		/* set inactive to IDENTITY */

        for (d=1; d<nxproc; d = d<<1)		/* 1st results go east */
    	    if ((ixproc & d-1) == d-1)
    	        src += xnetpW[d].src;

        for (d=1; d<nyproc; d = d<<1)		/* then results go south */
    	    if ((iyproc & d-1) == d-1)
    	        src += xnetpN[d].src;

	return( proc[nproc-1].src );
    }
}
