home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 316 / libsrc / bytes.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  753 b   |  41 lines

  1.  
  2. #ifdef DEBUG
  3. extern int stderr;    /* debug */
  4. #endif
  5.  
  6. bcopy(from, to, nbytes)
  7. register char * from, * to;
  8. register int nbytes;
  9. {
  10. #ifdef DEBUG
  11.   fprintf(stderr, "bcopy(%lx, %lx, %d)\n", from, to, nbytes);
  12. #endif
  13.   for( ; nbytes > 0 ; nbytes--)
  14.     *to++ = *from++;
  15. }
  16.  
  17. bcmp(b1, b2, nbytes)
  18. register char * b1, * b2;
  19. register int nbytes;
  20. {
  21.   register int i;
  22. #ifdef DEBUG
  23.   fprintf(stderr, "bcmp(%lx, %lx, %d)\n", b1, b2, nbytes);
  24. #endif
  25.   for(i = 1 ; nbytes > 0 ; nbytes--, i++)
  26.     if (*b1++ != *b2++)
  27.         return(i);
  28.   return(0);        
  29. }
  30.  
  31. bzero(bytes, nbytes)
  32. register char *bytes;
  33. register int nbytes;
  34. {
  35. #ifdef DEBUG
  36.   fprintf(stderr, "bzero(%lx, %d)\n", bytes, nbytes);
  37. #endif
  38.   for( ; nbytes > 0 ; nbytes--)
  39.     *bytes++ = 0;
  40. }
  41.