[net.sources.mac] macbin.c

jimb@amdcad.UUCP (Jim Budler) (03/08/86)

Sorry.  Here is a version of bzero.c which came across the net last year
with top.  It is Vax only, but hopefully will help the non-4.2.
---------------------< cut here >----------------------------
/*
 *  Fast, sleazy, and ugly zero function.
 *
 *  Note that this will only work on a VAX, but it is real easy to write a
 *  similar function for whatever machine you may need.  If nothing else,
 *  just a simple loop in C will suffice.
 *
 *  Dave Johnson, Rice University.
 *
 *  Enhanced by William LeFebvre of Rice University to handle zeroing more
 *  than 64K.
 */

# define   K	1024

/*
 *  bzero(memory, amount) - set "amount" bytes starting at "memory" to the
 *			    value 0.
 */

bzero(memory, amount)

char *memory;
int  amount;

{
    while (amount >= 64*K)
    {
	_bzero64(memory, 64*K-1);
	memory += 64*K-1;
	amount -= 64*K-1;
    }
    _bzero64(memory, amount);
}

_bzero64(memory, amount)

char *memory;
int  amount;

{
    asm("	movc5	$0, (sp), $0, 8(ap), *4(ap)");
}
-- 
 Jim Budler
 Advanced Micro Devices, Inc.
 (408) 749-5806
 Usenet: {ucbvax,decwrl,ihnp4,allegra,intelca}!amdcad!jimb
 Compuserve:	72415,1200