2021-10-03から1日間の記事一覧

string.c int strlen(const char *s)

トップページ jupiteroak.hatenablog.com string.c https://github.com/mit-pdos/xv6-public/blob/master/string.c#L96 int strlen(const char *s) { int n; for(n = 0; s[n]; n++) ; return n; }strlen関数は、引数sが指定する文字列データのサイズ(バイト…

string.c char* safestrcpy(char *s, const char *t, int n)

トップページ jupiteroak.hatenablog.com string.c https://github.com/mit-pdos/xv6-public/blob/master/string.c#L82 char* safestrcpy(char *s, const char *t, int n) { char *os; os = s; if(n <= 0) return os; while(--n > 0 && (*s++ = *t++) != 0) …

string.c char* strncpy(char *s, const char *t, int n)

トップページ jupiteroak.hatenablog.com string.c https://github.com/mit-pdos/xv6-public/blob/master/string.c#L68 char* strncpy(char *s, const char *t, int n) { char *os; os = s; while(n-- > 0 && (*s++ = *t++) != 0) ; while(n-- > 0) *s++ = 0…

string.c int strncmp(const char *p, const char *q, uint n)

トップページ jupiteroak.hatenablog.com string.c https://github.com/mit-pdos/xv6-public/blob/master/string.c#L58 int strncmp(const char *p, const char *q, uint n) { while(n > 0 && *p && *p == *q) n--, p++, q++; if(n == 0) return 0; return (…

string.c void* memcpy(void *dst, const void *src, uint n)

トップページ jupiteroak.hatenablog.com

string.c void* memmove(void *dst, const void *src, uint n)

トップページ jupiteroak.hatenablog.com string.c https://github.com/mit-pdos/xv6-public/blob/master/string.c#L31 void* memmove(void *dst, const void *src, uint n) { const char *s; char *d; s = src; d = dst; if(s < d && s + n > d){ s += n; d…

string.c int memcmp(const void *v1, const void *v2, uint n)

トップページ jupiteroak.hatenablog.com string.c https://github.com/mit-pdos/xv6-public/blob/master/string.c#L15 int memcmp(const void *v1, const void *v2, uint n) { const uchar *s1, *s2; s1 = v1; s2 = v2; while(n-- > 0){ if(*s1 != *s2) ret…

string.c void* memset(void *dst, int c, uint n)

トップページ jupiteroak.hatenablog.com string.c https://github.com/mit-pdos/xv6-public/blob/master/string.c#L4 void* memset(void *dst, int c, uint n) { if ((int)dst%4 == 0 && n%4 == 0){ c &= 0xFF; stosl(dst, (c<<24)|(c<<16)|(c<<8)|c, n/4);…