mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Shave another 2% off GNU Make latency
This commit is contained in:
parent
8722006c46
commit
253cc1754b
1 changed files with 13 additions and 3 deletions
16
third_party/make/hash.c
vendored
16
third_party/make/hash.c
vendored
|
@ -17,7 +17,9 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#include "third_party/make/makeint.inc"
|
||||
/**/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/intrin/likely.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/nexgen32e/bsr.h"
|
||||
#include "third_party/make/hash.h"
|
||||
/* clang-format off */
|
||||
|
@ -442,27 +444,35 @@ jhash_string(unsigned const char *k)
|
|||
/* Set up the internal state */
|
||||
a = b = c = JHASH_INITVAL;
|
||||
|
||||
for (; klen > 12; k += 12, klen -= 12)
|
||||
{
|
||||
a += READ32LE (k + 0);
|
||||
b += READ32LE (k + 4);
|
||||
c += READ32LE (k + 8);
|
||||
jhash_mix (a, b, c);
|
||||
}
|
||||
|
||||
/* All but the last block: affect some 32 bits of (a,b,c) */
|
||||
for (;;) {
|
||||
sum_up_to_nul(a, k, klen, have_nul);
|
||||
if (have_nul)
|
||||
break;
|
||||
k += UINTSZ;
|
||||
assert (klen >= UINTSZ);
|
||||
DCHECK (klen >= UINTSZ);
|
||||
klen -= UINTSZ;
|
||||
|
||||
sum_up_to_nul(b, k, klen, have_nul);
|
||||
if (have_nul)
|
||||
break;
|
||||
k += UINTSZ;
|
||||
assert (klen >= UINTSZ);
|
||||
DCHECK (klen >= UINTSZ);
|
||||
klen -= UINTSZ;
|
||||
|
||||
sum_up_to_nul(c, k, klen, have_nul);
|
||||
if (have_nul)
|
||||
break;
|
||||
k += UINTSZ;
|
||||
assert (klen >= UINTSZ);
|
||||
DCHECK (klen >= UINTSZ);
|
||||
klen -= UINTSZ;
|
||||
jhash_mix(a, b, c);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue