mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-01-18 13:59:34 +08:00
sync udp2raw bugfix
This commit is contained in:
parent
3ac5e6b40d
commit
c3debb0290
@ -895,8 +895,8 @@ int new_connected_socket2(int &fd, address_t &addr, address_t *bind_addr, char *
|
|||||||
u32_t djb2(unsigned char *str, int len) {
|
u32_t djb2(unsigned char *str, int len) {
|
||||||
u32_t hash = 5381;
|
u32_t hash = 5381;
|
||||||
int c;
|
int c;
|
||||||
int i = 0;
|
for (int i=0; i<len ;i++) {
|
||||||
while (c = *str++, i++ != len) {
|
c = *(str++);
|
||||||
hash = ((hash << 5) + hash) ^ c; /* (hash * 33) ^ c */
|
hash = ((hash << 5) + hash) ^ c; /* (hash * 33) ^ c */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -907,14 +907,15 @@ u32_t djb2(unsigned char *str, int len) {
|
|||||||
u32_t sdbm(unsigned char *str, int len) {
|
u32_t sdbm(unsigned char *str, int len) {
|
||||||
u32_t hash = 0;
|
u32_t hash = 0;
|
||||||
int c;
|
int c;
|
||||||
int i = 0;
|
for (int i=0; i<len ;i++) {
|
||||||
while (c = *str++, i++ != len) {
|
c = *(str++);
|
||||||
hash = c + (hash << 6) + (hash << 16) - hash;
|
hash = c + (hash << 6) + (hash << 16) - hash;
|
||||||
}
|
}
|
||||||
// hash=htonl(hash);
|
// hash=htonl(hash);
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vector<string> string_to_vec(const char *s, const char *sp) {
|
vector<string> string_to_vec(const char *s, const char *sp) {
|
||||||
vector<string> res;
|
vector<string> res;
|
||||||
string str = s;
|
string str = s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user