home *** CD-ROM | disk | FTP | other *** search
/ ftp.muug.mb.ca / 2014.06.ftp.muug.mb.ca.tar / ftp.muug.mb.ca / pub / src / top / bzero.c < prev    next >
C/C++ Source or Header  |  1992-02-01  |  789b  |  44 lines

  1. /*
  2.  *  Fast, sleazy, and ugly zero function.
  3.  *
  4.  *  Note that this will only work on a VAX, but it is real easy to write a
  5.  *  similar function for whatever machine you may need.  If nothing else,
  6.  *  just a simple loop in C will suffice.
  7.  *
  8.  *  Dave Johnson, Rice University.
  9.  *
  10.  *  Enhanced by William LeFebvre of Rice University to handle zeroing more
  11.  *  than 64K.
  12.  */
  13.  
  14. # define   K    1024
  15.  
  16. /*
  17.  *  bzero(memory, amount) - set "amount" bytes starting at "memory" to the
  18.  *                value 0.
  19.  */
  20.  
  21. bzero(memory, amount)
  22.  
  23. char *memory;
  24. int  amount;
  25.  
  26. {
  27.     while (amount >= 64*K)
  28.     {
  29.     _bzero64(memory, 64*K-1);
  30.     memory += 64*K-1;
  31.     amount -= 64*K-1;
  32.     }
  33.     _bzero64(memory, amount);
  34. }
  35.  
  36. _bzero64(memory, amount)
  37.  
  38. char *memory;
  39. int  amount;
  40.  
  41. {
  42.     asm("    movc5    $0, (sp), $0, 8(ap), *4(ap)");
  43. }
  44.