ASFLAGS += -D ARCHDIR=$(ARCHDIR) -D __ASSEMBLER__=1
CPPFLAGS := -I$(ACESSDIR)/Usermode/include/ -DARCHDIR=$(ARCHDIR) -DARCHDIR_is_$(ARCHDIR)=1
-CFLAGS := -g -Wall -fPIC -fno-builtin -fno-stack-protector $(CPPFLAGS)
+CFLAGS := -g -Wall -fPIC -fno-stack-protector -O3
LDFLAGS := -g -nostdlib -shared -I/Acess/Libs/ld-acess.so -lld-acess -e SoMain -x -L$(OUTPUTDIR)Libs/ --no-undefined
*/
EXPORT int strcmp(const char *s1, const char *s2)
{
- while(*s1 == *s2 && *s1 != '\0' && *s2 != '\0') {
+ while(*s1 && *s1 == *s2) {
s1++; s2++;
}
return (int)*s1 - (int)*s2;
*/
EXPORT int strncmp(const char *s1, const char *s2, size_t n)
{
- while(n && *s1 == *s2 && *s1 != '\0' && *s2 != '\0')
+ while(n && *s1 && *s1 == *s2)
{
s1++; s2++;
n --;
const char *sp = __src;
while(count--) *dp++ = *sp ++;
}
+ // TODO: Bulk aligned copies
+ #if 0
+ else if(count > 128 && (dst & 15) == (src & 15) )
+ {
+ // SSE/bulk copy
+ for( ; dst & 15; count -- )
+ *(char*)dst++ = *(char*)src++;
+ memcpy_16byte(dst, src, count / 16);
+ dst += count & ~15;
+ src += count & ~15;
+ count &= 15;
+ while(count --)
+ *(char*)dst++ = *(char*)src++;
+ }
+ #endif
else
{
void **dp, **sp;
*/
EXPORT void *memmove(void *dest, const void *src, size_t count)
{
- char *sp = (char *)src;
- char *dp = (char *)dest;
- // Check if corruption will happen
+ char *sp = (char *)src;
+ char *dp = (char *)dest;
+ // Check if the areas overlap
if( (intptr_t)dest > (intptr_t)src && (intptr_t)dest < (intptr_t)src+count )
for(;count--;) dp[count] = sp[count];
else
- for(;count--;) *dp++ = *sp++;
- return dest;
+ for(;count--;) *dp++ = *sp++;
+ return dest;
}
/**
*/
EXPORT int memcmp(const void *mem1, const void *mem2, size_t count)
{
+ const unsigned char *p1 = mem1, *p2 = mem2;
while(count--)
{
- if( *(unsigned char*)mem1 != *(unsigned char*)mem2 )
- return *(unsigned char*)mem1 - *(unsigned char*)mem2;
- mem1 ++;
- mem2 ++;
+ if( *p1 != *p2 )
+ return *p1 - *p2;
+ p1 ++;
+ p2 ++;
}
return 0;
}
extern char *strncpy(char *dst, const char *src, size_t num);
extern char *strcat(char *dst, const char *src);
extern char *strdup(const char *src);
-extern char *strndup(const char *src, int length);
+extern char *strndup(const char *src, size_t length);
extern char *strchr(const char *str, int character);
extern char *strrchr(const char *str, int character);
extern char *strstr(const char *str1, const char *str2);