mempcpy.c 611 B

12345678910111213141516171819202122232425262728293031323334353637
  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 WANT_WIDE
  9. # define Wmempcpy wmempcpy
  10. #else
  11. # define Wmempcpy mempcpy
  12. #endif
  13. libc_hidden_proto(Wmempcpy)
  14. Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
  15. {
  16. register Wchar *r1 = s1;
  17. register const Wchar *r2 = s2;
  18. #ifdef __BCC__
  19. while (n--) {
  20. *r1++ = *r2++;
  21. }
  22. #else
  23. while (n) {
  24. *r1++ = *r2++;
  25. --n;
  26. }
  27. #endif
  28. return r1;
  29. }
  30. libc_hidden_def(Wmempcpy)