travis-ci
666 of 666 new or added lines in 33 files covered. (100.0%)
15837 of 20949 relevant lines covered (75.6%)
606182.36 hits per line
1 |
#pragma once
|
|
2 |
#include <cstdint> // defines size_t |
|
3 |
#include "future_compat.h" |
|
4 |
#include "hash.h" |
|
5 |
|
|
|
VW_STD14_CONSTEXPR inline uint64_t hashall(const char * s, size_t len, uint64_t h) |
96✔ |
7 |
{ |
|
|
return uniform_hash(s, len, h);
|
96✔ |
9 |
} |
|
10 |
|
|
|
VW_STD14_CONSTEXPR inline uint64_t hashstring(const char* s, size_t len, uint64_t h) |
2,250,662✔ |
12 |
{ |
|
|
const char* front = s; |
2,250,662✔ |
|
while (len > 0 && front[0] <= 0x20 && (int)(front[0]) >= 0) |
4,502,600✔ |
15 |
{ |
|
|
++front; |
1,276✔ |
|
--len; |
1,276✔ |
18 |
} |
|
|
while (len > 0 && front[len - 1] <= 0x20 && (int)(front[len - 1]) >= 0) |
4,501,324✔ |
20 |
{ |
|
|
--len; |
× |
22 |
} |
|
23 |
|
|
24 |
size_t ret = 0;
|
2,250,662✔ |
|
const char* p = front; |
2,250,662✔ |
|
while (p != front + len)
|
10,211,977✔ |
27 |
if (*p >= '0' && *p <= '9') |
6,386,363✔ |
28 |
ret = 10 * ret + *(p++) - '0'; |
5,710,653✔ |
29 |
else
|
|
|
return uniform_hash(front, len, h);
|
675,710✔ |
31 |
|
|
32 |
return ret + h;
|
1,574,952✔ |
33 |
} |