?? utils.c
字號(hào):
#include "utils.h"
#ifndef SELF_BOOT
void *memcpy(void *s1, const void *s2, int n)
{
int i;
for (i = 0; i < n; i++)
((char *)(s1))[i] = ((const char *)(s2))[i];
return s1;
}
void *memset(void *s, const char ch, int n)
{
int i;
for (i = 0; i < n; i++)
((char *)(s))[i] = ch;
return s;
}
unsigned short ntohs(unsigned short s)
{
return (s >> 8) | (s << 8);
}
unsigned long ntohl(unsigned long l)
{
return ((l >> 24) & 0x000000ff) |
((l >> 8) & 0x0000ff00) |
((l << 8) & 0x00ff0000) |
((l << 24) & 0xff000000);
}
unsigned short htons(unsigned short s)
{
return (s >> 8) | (s << 8);
}
unsigned long htonl(unsigned long l)
{
return ((l >> 24) & 0x000000ff) |
((l >> 8) & 0x0000ff00) |
((l << 8) & 0x00ff0000) |
((l << 24) & 0xff000000);
}
#endif
int strlen(const char *s)
{
int i ;
i = 0 ;
while (s[i] != '\0') i++ ;
return i ;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -