| Line | |
|---|
| 1 | /* |
|---|
| 2 | * string.h |
|---|
| 3 | */ |
|---|
| 4 | |
|---|
| 5 | #ifndef _STRING_H |
|---|
| 6 | #define _STRING_H |
|---|
| 7 | |
|---|
| 8 | /* Standard routines */ |
|---|
| 9 | #define memcpy(a,b,c) __builtin_memcpy(a,b,c) |
|---|
| 10 | #define memmove(a,b,c) __builtin_memmove(a,b,c) |
|---|
| 11 | #define memset(a,b,c) __builtin_memset(a,b,c) |
|---|
| 12 | #define strcpy(a,b) __builtin_strcpy(a,b) |
|---|
| 13 | #define strlen(a) __builtin_strlen(a) |
|---|
| 14 | |
|---|
| 15 | /* This only returns true or false */ |
|---|
| 16 | static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n) |
|---|
| 17 | { |
|---|
| 18 | _Bool rv; |
|---|
| 19 | asm volatile ("cld ; repe ; cmpsb ; setne %0":"=abd" (rv), "+D"(__m1), |
|---|
| 20 | "+S"(__m2), "+c"(__n)); |
|---|
| 21 | return rv; |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | extern char *strchr(const char *s, int c); |
|---|
| 25 | |
|---|
| 26 | #endif /* _STRING_H */ |
|---|