bcopy.c 517 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (C) 2002 Manuel Novoa III
  3. * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
  4. *
  5. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  6. */
  7. #include <string.h>
  8. #ifdef __UCLIBC_SUSV3_LEGACY__
  9. void bcopy(const void *s2, void *s1, size_t n)
  10. {
  11. #if 1
  12. memmove(s1, s2, n);
  13. #else
  14. register char *s;
  15. register const char *p;
  16. s = s1;
  17. p = s2;
  18. if (p >= s) {
  19. while (n) {
  20. *s++ = *p++;
  21. --n;
  22. }
  23. } else {
  24. while (n) {
  25. --n;
  26. s[n] = p[n];
  27. }
  28. }
  29. #endif
  30. }
  31. #endif