home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / c / string.arc / BFILL.C < prev    next >
Text File  |  1984-12-31  |  1KB  |  39 lines

  1. /*  File   : bfill.c
  2.     Author : Richard A. O'Keefe.
  3.     Updated: 23 April 1984
  4.     Defines: bfill()
  5.  
  6.     bfill(dst, len, fill) moves "len" fill characters to "dst".
  7.     Thus to set a buffer to 80 spaces, do bfill(buff, 80, ' ').
  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 bfill(dst, len, fill)
  19.     char *dst;
  20.     int len;
  21.     int fill;    /* actually char */
  22.     {
  23.     asm("movc5 $0,*4(ap),12(ap),8(ap),*4(ap)");
  24.     }
  25.  
  26. #else  ~VaxAsm
  27.  
  28. void bfill(dst, len, fill)
  29.     register char *dst;
  30.     register int len;
  31.     register int fill;    /* char */
  32.     {
  33.     while (--len >= 0) *dst++ = fill;
  34.  
  35.     }
  36.  
  37. #endif    VaxAsm
  38.