memset.c 513 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * aboot/lib/memset.c
  3. *
  4. * Copyright (c) 1995 David Mosberger (davidm@cs.arizona.edu)
  5. */
  6. #include <linux/types.h>
  7. #include <stddef.h>
  8. /*
  9. * Booting is I/O bound so rather than a time-optimized, we want
  10. * a space-optimized memcpy. Not that the rest of the loader
  11. * were particularly small, though...
  12. */
  13. void *__memset(void *s, char c, size_t n)
  14. {
  15. char *dst = s;
  16. while (n--) {
  17. *dst++ = c;
  18. }
  19. return s;
  20. }
  21. void *__constant_c_memset(void *dest, char c, size_t n)
  22. {
  23. return __memset(dest, c, n);
  24. }