Initial import of libucore

This commit is contained in:
Nils O. Selåsdal
2012-10-29 23:07:32 +01:00
commit ed3866e49a
79 changed files with 6181 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#include "ucore_hash.h"
uint32_t
uc_elfhash(const char *str, uint32_t len)
{
uint32_t hash = 0;
uint32_t x = 0;
uint32_t i = 0;
for (i = 0; i < len; str++, i++) {
hash = (hash << 4) + (*str);
if ((x = hash & 0xF0000000L) != 0) {
hash ^= (x >> 24);
hash &= ~x;
}
}
return hash;
}