home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / c / string.arc / BZERO.C < prev    next >
C/C++ Source or Header  |  1984-12-31  |  768b  |  36 lines

  1. /*  File   : bzero.c
  2.     Author : Richard A. O'Keefe.
  3.     Updated: 23 April 1984
  4.     Defines: bzero()
  5.  
  6.     bzero(dst, len) moves "len" 0 bytes to "dst".
  7.     Thus to clear a disc buffer to 0s do bzero(buffer, BUFSIZ).
  8.  
  9.     Note: the "b" routines are there to exploit certain VAX order codes,
  10.     but the MOVC5 instruction will only move 65535 characters.   The asm
  11.     code is presented for your interest and amusement.
  12. */
  13.  
  14. #include "strings.h"
  15.  
  16. #if    VaxAsm
  17.  
  18. void bzero(dst, len)
  19.     char *dst;
  20.     int len;
  21.     {
  22.     asm("movc5 $0,*4(ap),$0,8(ap),*4(ap)");
  23.     }
  24.  
  25. #else  ~VaxAsm
  26.  
  27. void bzero(dst, len)
  28.     register char *dst;
  29.     register int len;
  30.     {
  31.     while (--len >= 0) *dst++ = 0;
  32.     }
  33.  
  34. #endif    VaxAsm
  35.