提高性能

This commit is contained in:
xiongziliang 2020-05-26 21:04:53 +08:00
parent 7b90daab24
commit 53ca43fb7d

View File

@ -79,13 +79,20 @@ int prefixSize(const char *ptr, int len){
return 0; return 0;
} }
if (memcmp("\x00\x00\x01", ptr, 3) == 0) { if (ptr[0] != 0x00 || ptr[1] != 0x00) {
return 3; //不是0x00 00开头
return 0;
} }
if (memcmp("\x00\x00\x00\x01", ptr, 4) == 0) { if (ptr[2] == 0x00 && ptr[3] == 0x01) {
//是0x00 00 00 01
return 4; return 4;
} }
if (ptr[2] == 0x01) {
//是0x00 00 01
return 3;
}
return 0; return 0;
} }