10 char *strcpy(char *dest, const char *src)
21 char *strcat(char *dest, const char *src)
25 while(*src) *dest++ = *src++;
31 * \fn int strcmp(const char *s1, const char *s2)
32 * \brief Compare two strings
34 int strcmp(const char *s1, const char *s2)
36 while(*s1 && *s1 == *s2) s1++,s2++;
41 * \fn int strlen(const char *str)
44 int strlen(const char *str)
47 while(*str) len++,str++;
51 int memcmp(const void *p1, const void *p2, int len)
53 const char *b1 = p1, *b2 = p2;
56 if(b1 != b2) return b1 - b2;
61 void *memcpy(void *dest, const void *src, size_t len)
65 while(len--) *d++ = *s++;
70 * \fn int file_exists(char *filename)
71 * \brief Checks if a file exists
73 int file_exists(const char *filename)
76 fd = _SysOpen(filename, 0);
77 if(fd == -1) return 0;
82 uint64_t __divmod64(uint64_t Num, uint64_t Den, uint64_t *Rem)
84 uint64_t ret = 0, add = 1;
91 // Find what power of two times Den is > Num
103 // If the numerator is >= Den, subtract and add to return value
115 uint32_t __divmod32(uint32_t Num, uint32_t Den, uint32_t *Rem)
117 uint32_t ret = 0, add = 1;
124 // Find what power of two times Den is > Num
136 // If the numerator is >= Den, subtract and add to return value
147 uint64_t __udivdi3(uint64_t Num, uint64_t Den)
149 return __divmod64(Num, Den, NULL);
152 uint64_t __umoddi3(uint64_t Num, uint64_t Den)
155 __divmod64(Num, Den, &ret);
159 int32_t __divsi3(int32_t Num, int32_t Den)
170 return sign * __divmod32(Num, Den, NULL);
173 int32_t __modsi3(int32_t Num, int32_t Den)
185 __divmod32(Num, Den, &tmp);
186 return ((int32_t)tmp)*sign;
189 uint32_t __udivsi3(uint32_t Num, uint32_t Den)
191 return __divmod32(Num, Den, NULL);
195 uint32_t __umodsi3(uint32_t Num, uint32_t Den)
198 __divmod32(Num, Den, &ret);