Files
RedBear-OS/recipes/wip/dev/other/gperf/source/lib/hash.cc
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

28 lines
584 B
C++

/*
Copyright (C) 1990, 2000, 2002 Free Software Foundation
written by Doug Lea <dl@rocky.oswego.edu>
*/
#include <hash.h>
/*
Some useful hash function.
It's not a particularly good hash function (<< 5 would be better than << 4),
but people believe in it because it comes from Dragon book.
*/
unsigned int
hashpjw (const unsigned char *x, unsigned int len) // From Dragon book, p436
{
unsigned int h = 0;
unsigned int g;
for (; len > 0; len--)
{
h = (h << 4) + *x++;
if ((g = h & 0xf0000000) != 0)
h = (h ^ (g >> 24)) ^ g;
}
return h;
}