string.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 2011 Andes Technology Corporation
  3. * Copyright (C) 2010 Shawn Lin (nobuhiro@andestech.com)
  4. * Copyright (C) 2011 Macpaul Lin (macpaul@andestech.com)
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #ifndef __ASM_NDS_STRING_H
  11. #define __ASM_NDS_STRING_H
  12. /*
  13. * We don't do inline string functions, since the
  14. * optimised inline asm versions are not small.
  15. */
  16. #undef __HAVE_ARCH_STRRCHR
  17. extern char *strrchr(const char *s, int c);
  18. #undef __HAVE_ARCH_STRCHR
  19. extern char *strchr(const char *s, int c);
  20. #undef __HAVE_ARCH_MEMCPY
  21. extern void *memcpy(void *, const void *, __kernel_size_t);
  22. #undef __HAVE_ARCH_MEMMOVE
  23. extern void *memmove(void *, const void *, __kernel_size_t);
  24. #undef __HAVE_ARCH_MEMCHR
  25. extern void *memchr(const void *, int, __kernel_size_t);
  26. #undef __HAVE_ARCH_MEMZERO
  27. #undef __HAVE_ARCH_MEMSET
  28. extern void *memset(void *, int, __kernel_size_t);
  29. #ifdef CONFIG_MARCO_MEMSET
  30. extern void __memzero(void *ptr, __kernel_size_t n);
  31. #define memset(p, v, n) \
  32. ({ \
  33. if ((n) != 0) { \
  34. if (__builtin_constant_p((v)) && (v) == 0) \
  35. __memzero((p), (n)); \
  36. else \
  37. memset((p), (v), (n)); \
  38. } \
  39. (p); \
  40. })
  41. #define memzero(p, n) ({ if ((n) != 0) __memzero((p), (n)); (p); })
  42. #else
  43. extern void memzero(void *ptr, __kernel_size_t n);
  44. #endif
  45. #endif /* __ASM_NDS_STRING_H */