system.c 369 B

1234567891011121314151617181920212223242526272829
  1. /* (c) Daniele Lacamera 2019
  2. * GPL
  3. */
  4. #include <stdint.h>
  5. #include "system.h"
  6. #include <string.h>
  7. extern uint32_t cpu_freq;
  8. void *memset(void *s, int c, size_t n)
  9. {
  10. unsigned char *d = (unsigned char *)s;
  11. while (n--) {
  12. *d++ = (unsigned char)c;
  13. }
  14. return s;
  15. }
  16. size_t strlen(const char *s)
  17. {
  18. int i = 0;
  19. while (s[i] != 0)
  20. i++;
  21. return i;
  22. }